rippled
Loading...
Searching...
No Matches
csprng.h
1#pragma once
2
3#include <mutex>
4
5namespace xrpl {
6
16{
17private:
19
20public:
22
23 csprng_engine(csprng_engine const&) = delete;
25 operator=(csprng_engine const&) = delete;
26
30
33
35 void
36 mix_entropy(void* buffer = nullptr, std::size_t count = 0);
37
40 operator()();
41
43 void
44 operator()(void* ptr, std::size_t count);
45
46 /* The smallest possible value that can be returned */
47 static constexpr result_type
52
53 /* The largest possible value that can be returned */
54 static constexpr result_type
59};
60
69csprng_engine&
71
72} // namespace xrpl
A cryptographically secure random number engine.
Definition csprng.h:16
csprng_engine(csprng_engine const &)=delete
void mix_entropy(void *buffer=nullptr, std::size_t count=0)
Mix entropy into the pool.
result_type operator()()
Generate a random integer.
csprng_engine & operator=(csprng_engine const &)=delete
std::uint64_t result_type
Definition csprng.h:21
csprng_engine(csprng_engine &&)=delete
static constexpr result_type max()
Definition csprng.h:55
std::mutex mutex_
Definition csprng.h:18
static constexpr result_type min()
Definition csprng.h:48
csprng_engine & operator=(csprng_engine &&)=delete
T max(T... args)
T min(T... args)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
csprng_engine & crypto_prng()
The default cryptographically secure PRNG.