|
Tor
0.4.7.0-alpha-dev
|
A weak but fast PRNG based on a linear congruential generator. More...
Go to the source code of this file.
Functions | |
| void | tor_init_weak_random (tor_weak_rng_t *rng, unsigned seed) |
| int32_t | tor_weak_random (tor_weak_rng_t *rng) |
| int32_t | tor_weak_random_range (tor_weak_rng_t *rng, int32_t top) |
A weak but fast PRNG based on a linear congruential generator.
We don't want to use the platform random(), since some of them are even worse than this.
Definition in file weakrng.c.
| 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 | ) |
| 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.