Functions | |
uint32_t | generateSecureWord32 () |
Generate a cryptographically secure random integer from the range [0, 2^32) More... | |
uint64_t | generateSecureWord64 () |
Generate a cryptographically secure random integer from the range [0, 2^64) More... | |
void | generateSecureBytes (uint8_t *bytes, size_t size) |
Fill bytes of size with cryptographically secure random bytes. More... | |
static std::mt19937 & | getRandomGenerator () |
uint32_t | generateWord32 () |
Generate a non-cryptographically-secure random integer in the range [0, 2^32) More... | |
uint64_t | generateWord64 () |
Generate a non-cryptographically-secure random integer in the range [0, 2^64) More... | |
uint32_t ndn::random::generateSecureWord32 | ( | ) |
Generate a cryptographically secure random integer from the range [0, 2^32)
std::runtime_error | if generation fails. |
Definition at line 31 of file random.cpp.
References generateSecureBytes().
uint64_t ndn::random::generateSecureWord64 | ( | ) |
Generate a cryptographically secure random integer from the range [0, 2^64)
std::runtime_error | if generation fails. |
Definition at line 39 of file random.cpp.
References generateSecureBytes().
void ndn::random::generateSecureBytes | ( | uint8_t * | bytes, |
size_t | size | ||
) |
Fill bytes
of size
with cryptographically secure random bytes.
std::runtime_error | if generation fails. |
Definition at line 47 of file random.cpp.
References ndn::to_string().
Referenced by generateSecureWord32(), and generateSecureWord64().
|
static |
Definition at line 56 of file random.cpp.
Referenced by generateWord32(), and generateWord64().
uint32_t ndn::random::generateWord32 | ( | ) |
Generate a non-cryptographically-secure random integer in the range [0, 2^32)
This version is faster than generateSecureWord32, but it must not be used when cryptographically secure random integers are needed (e.g., when creating signing or encryption keys)
Definition at line 63 of file random.cpp.
References getRandomGenerator().
Referenced by ndn::security::KeyChain::getDefaultKeyParamsForIdentity(), ndn::Interest::getNonce(), and ndn::Interest::refreshNonce().
uint64_t ndn::random::generateWord64 | ( | ) |
Generate a non-cryptographically-secure random integer in the range [0, 2^64)
This version is faster than generateSecureWord64, but it must not be used when cryptographically secure random integers are needed (e.g., when creating signing or encryption keys)
Definition at line 70 of file random.cpp.
References getRandomGenerator().
Referenced by ndn::security::KeyChain::getDefaultKeyParamsForIdentity(), and ndn::security::KeyChain::signWithSha256().