|
Tor 0.4.9.8
|
#include "lib/cc/torint.h"Go to the source code of this file.
Data Structures | |
| struct | tor_weak_rng_t |
Macros | |
| #define | TOR_WEAK_RNG_INIT {383745623} |
| #define | TOR_WEAK_RANDOM_MAX (INT_MAX) |
| #define | tor_weak_random_one_in_n(rng, n) |
Functions | |
| void | tor_init_weak_random (tor_weak_rng_t *weak_rng, unsigned seed) |
| int32_t | tor_weak_random (tor_weak_rng_t *weak_rng) |
| int32_t | tor_weak_random_range (tor_weak_rng_t *rng, int32_t top) |
| #define tor_weak_random_one_in_n | ( | rng, | |
| n ) |
Randomly return true according to rng with probability 1 in n
| void tor_init_weak_random | ( | tor_weak_rng_t * | rng, |
| unsigned | seed ) |
Initialize the insecure RNG rng from a seed value seed.
Definition at line 22 of file weakrng.c.
Referenced by crypto_seed_weak_rng().
| int32_t tor_weak_random | ( | tor_weak_rng_t * | rng | ) |
Return a randomly chosen value in the range 0..TOR_WEAK_RANDOM_MAX based on the RNG state of rng. This entropy will not be cryptographically strong; do not rely on it for anything an adversary should not be able to predict.
Definition at line 32 of file weakrng.c.
Referenced by tor_weak_random_range().
| int32_t tor_weak_random_range | ( | tor_weak_rng_t * | rng, |
| int32_t | top ) |
Return a random number in the range [0 , top). {That is, the range of integers i such that 0 <= i < top.} Chooses uniformly. Requires that top is greater than 0. This randomness is not cryptographically strong; do not rely on it for anything an adversary should not be able to predict.