xrpld
Loading...
Searching...
No Matches
tests/libxrpl/crypto/csprng.cpp
1#include <xrpl/crypto/csprng.h>
2
3#include <gtest/gtest.h>
4
5#include <cstdint>
6
7using namespace xrpl;
8
9TEST(csprng, get_values)
10{
11 auto& engine = cryptoPrng();
12 auto randVal = engine();
13 EXPECT_GE(randVal, engine.min());
14 EXPECT_LE(randVal, engine.max());
15 uint16_t twoByte{0};
16 engine(&twoByte, sizeof(uint16_t));
17}
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.