xrpld
Loading...
Searching...
No Matches
csprng.h
1#pragma once
2
3#include <mutex>
4
5namespace xrpl {
6
16{
17private:
19
20public:
22
23 CsprngEngine(CsprngEngine const&) = delete;
25 operator=(CsprngEngine const&) = delete;
26
30
33
35 void
36 mixEntropy(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
69CsprngEngine&
71
72} // namespace xrpl
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
CsprngEngine(CsprngEngine &&)=delete
CsprngEngine(CsprngEngine const &)=delete
CsprngEngine & operator=(CsprngEngine const &)=delete
result_type operator()()
Generate a random integer.
CsprngEngine & operator=(CsprngEngine &&)=delete
std::uint64_t result_type
Definition csprng.h:21
void mixEntropy(void *buffer=nullptr, std::size_t count=0)
Mix entropy into the pool.
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
CsprngEngine & cryptoPrng()
The default cryptographically secure PRNG.