Changeset View
Changeset View
Standalone View
Standalone View
src/random.h
Show First 20 Lines • Show All 85 Lines • ▼ Show 20 Lines | |||||
* | * | ||||
* This function will cause failure whenever the OS RNG fails. | * This function will cause failure whenever the OS RNG fails. | ||||
* | * | ||||
* Thread-safe. | * Thread-safe. | ||||
*/ | */ | ||||
void GetStrongRandBytes(uint8_t *buf, int num) noexcept; | void GetStrongRandBytes(uint8_t *buf, int num) noexcept; | ||||
/** | /** | ||||
* Sleep for 1ms, gather entropy from various sources, and feed them to the PRNG | * Gather entropy from various expensive sources, and feed them to the PRNG | ||||
* state. | * state. | ||||
* | * | ||||
* Thread-safe. | * Thread-safe. | ||||
*/ | */ | ||||
void RandAddSeedSleep(); | void RandAddPeriodic(); | ||||
/** | /** | ||||
* Fast randomness source. This is seeded once with secure random data, but | * Fast randomness source. This is seeded once with secure random data, but | ||||
* is completely deterministic and does not gather more entropy after that. | * is completely deterministic and does not gather more entropy after that. | ||||
* | * | ||||
* This class is not thread-safe. | * This class is not thread-safe. | ||||
*/ | */ | ||||
class FastRandomContext { | class FastRandomContext { | ||||
▲ Show 20 Lines • Show All 154 Lines • Show Last 20 Lines |