rippled
Loading...
Searching...
No Matches
csprng.h
1#ifndef XRPL_CRYPTO_RANDOM_H_INCLUDED
2#define XRPL_CRYPTO_RANDOM_H_INCLUDED
3
4#include <mutex>
5
6namespace ripple {
7
17{
18private:
20
21public:
23
24 csprng_engine(csprng_engine const&) = delete;
26 operator=(csprng_engine const&) = delete;
27
31
34
36 void
37 mix_entropy(void* buffer = nullptr, std::size_t count = 0);
38
41 operator()();
42
44 void
45 operator()(void* ptr, std::size_t count);
46
47 /* The smallest possible value that can be returned */
48 static constexpr result_type
53
54 /* The largest possible value that can be returned */
55 static constexpr result_type
60};
61
70csprng_engine&
72
73} // namespace ripple
74
75#endif
A cryptographically secure random number engine.
Definition csprng.h:17
static constexpr result_type min()
Definition csprng.h:49
std::uint64_t result_type
Definition csprng.h:22
csprng_engine(csprng_engine const &)=delete
csprng_engine & operator=(csprng_engine const &)=delete
result_type operator()()
Generate a random integer.
csprng_engine(csprng_engine &&)=delete
std::mutex mutex_
Definition csprng.h:19
csprng_engine & operator=(csprng_engine &&)=delete
void mix_entropy(void *buffer=nullptr, std::size_t count=0)
Mix entropy into the pool.
static constexpr result_type max()
Definition csprng.h:56
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:6
csprng_engine & crypto_prng()
The default cryptographically secure PRNG.