xrpld
Loading...
Searching...
No Matches
csprng.h
1#pragma once
2
3#include <cstddef>
4#include <cstdint>
5#include <limits>
6#include <mutex>
7
8namespace xrpl {
9
20{
21private:
23
24public:
26
27 CsprngEngine(CsprngEngine const&) = delete;
29 operator=(CsprngEngine const&) = delete;
30
34
37
41 void
42 mixEntropy(void* buffer = nullptr, std::size_t count = 0);
43
48 operator()();
49
53 void
54 operator()(void* ptr, std::size_t count);
55
56 /* The smallest possible value that can be returned */
57 static constexpr result_type
62
63 /* The largest possible value that can be returned */
64 static constexpr result_type
69};
70
80CsprngEngine&
82
83} // namespace xrpl
static constexpr result_type max()
Definition csprng.h:65
std::mutex mutex_
Definition csprng.h:22
static constexpr result_type min()
Definition csprng.h:58
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:25
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.