20#include <xrpl/basics/contract.h> 
   21#include <xrpl/crypto/csprng.h> 
   23#include <openssl/rand.h> 
   24#include <openssl/ssl.h> 
   38        Throw<std::runtime_error>(
"CSPRNG: Initial polling failed");
 
 
   44#if (OPENSSL_VERSION_NUMBER < 0x10100000L) 
 
   60        for (
auto& e : entropy)
 
   70        entropy.
size() * 
sizeof(std::random_device::result_type),
 
   73    if (buffer != 
nullptr && count != 0)
 
   74        RAND_add(buffer, count, 0);
 
 
   83#if (OPENSSL_VERSION_NUMBER < 0x10100000L) || !defined(OPENSSL_THREADS) 
   88        RAND_bytes(
reinterpret_cast<unsigned char*
>(ptr), count);
 
   91        Throw<std::runtime_error>(
"CSPRNG: Insufficient entropy");
 
 
A cryptographically secure random number engine.
 
std::uint64_t result_type
 
result_type operator()()
Generate a random integer.
 
void mix_entropy(void *buffer=nullptr, std::size_t count=0)
Mix entropy into the pool.
 
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
 
csprng_engine & crypto_prng()
The default cryptographically secure PRNG.