![]() | Fun 0.41.5 The programming language that makes You have fun |
Implements OP_RANDOM_NUMBER to generate cryptographically secure random bytes. More...
#include <inttypes.h>#include <stdint.h>#include <stdio.h>#include <stdlib.h>#include <string.h>
Go to the source code of this file.
Functions | |
| if (lv.type !=VAL_INT) | |
| if (len< 0) | |
| if (len==0) | |
| if (len > MAX_RAW) | |
| if (!raw||!hex) | |
| if (!ok) | |
| for (int64_t i=0;i< len;++i) | |
| free (raw) | |
| free (hex) | |
| free_value (lv) | |
| push_value (vm, s) | |
Variables | |
| case | OP_RANDOM_NUMBER |
| int64_t | len = lv.i |
| const int64_t | MAX_RAW = (1LL << 20) |
| unsigned char * | raw = (unsigned char *)malloc((size_t)len) |
| char * | hex = (char *)malloc((size_t)len * 2 + 1) |
| int | ok = 0 |
| Value | s = make_string(hex) |
| break | |
Implements OP_RANDOM_NUMBER to generate cryptographically secure random bytes.
Behavior:
Errors:
Definition in file random_number.c.
| for | ( | ) |
Definition at line 138 of file random_number.c.
| free | ( | hex | ) |
| free | ( | raw | ) |

| free_value | ( | lv | ) |

| if | ( | ! | ok | ) |
| if | ( | !raw||! | hex | ) |
| if | ( | ) |
| if | ( | len | = = 0 | ) |
| if | ( | lv.type ! | = VAL_INT | ) |
| push_value | ( | vm | , |
| s | ) |

| break |
Definition at line 150 of file random_number.c.
Definition at line 80 of file random_number.c.
| int64_t len = lv.i |
Definition at line 57 of file random_number.c.
| const int64_t MAX_RAW = (1LL << 20) |
Definition at line 71 of file random_number.c.
| ok = 0 |
Definition at line 89 of file random_number.c.
| case OP_RANDOM_NUMBER |
Definition at line 47 of file random_number.c.
| unsigned char* raw = (unsigned char *)malloc((size_t)len) |
Definition at line 79 of file random_number.c.
| Value s = make_string(hex) |
Definition at line 145 of file random_number.c.