Class Ase::KeccakRng
#include <randomhash.hh>
Inherited by the following classes: Ase::KeccakCryptoRng, Ase::KeccakFastRng, Ase::KeccakGoodRng
Public Types
Type | Name |
---|---|
typedef uint64_t | result_type Integral type of the KeccakRng generator results. |
Public Functions
Type | Name |
---|---|
KeccakRng (const KeccakRng &) = default |
|
KeccakRng (uint16_t hidden_state_capacity, uint16_t n_rounds) Create an unseeded Keccak PRNG with specific capacity and number of rounds, for experts only. |
|
void | auto_seed () Seed the generator from a system specific nondeterministic random source. |
size_t | bit_capacity () const Amount of bits used to store hidden random number generator state. |
void | discard (unsigned long long count) |
void | forget () |
void | generate (RandomAccessIterator begin, RandomAccessIterator end) Fill the range [begin, end) with random unsigned integer values. |
result_type | max () const Maximum of the result type, for uint64_t that is 18446744073709551615. |
result_type | min () const Minimum of the result type, for uint64_t that is 0. |
size_t | n_nums () const Amount of 64 bit random numbers per generated block. |
result_type | operator() () Generate uniformly distributed 32 bit pseudo random number. |
uint64_t | random () |
void | seed (uint64_t seed_value=1) Reinitialize the generator state using a 64 bit seed_value . |
void | seed (const uint64_t * seeds, size_t n_seeds) Reinitialize the generator state using a nuber of 64 bit seeds . |
void | seed (SeedSeq & seed_sequence) Seed the generator state from a seed_sequence . |
void | xor_seed (const uint64_t * seeds, size_t n_seeds) |
~KeccakRng () The destructor resets the generator state to avoid leaving memory trails. |
Detailed Description
KeccakRng - A KeccakF1600 based pseudo-random number generator. The permutation steps are derived from the Keccak specification Keccak11 . For further details about this implementation, see also: http://testbit.eu/ This class is primarily used to implement more fine tuned generators, such as: KeccakCryptoRng, KeccakGoodRng and KeccakFastRng.
Public Types Documentation
typedef result_type
typedef uint64_t Ase::KeccakRng::result_type;
Public Functions Documentation
function KeccakRng [1/2]
Ase::KeccakRng::KeccakRng (
const KeccakRng &
) = default
function KeccakRng [2/2]
inline explicit Ase::KeccakRng::KeccakRng (
uint16_t hidden_state_capacity,
uint16_t n_rounds
)
function auto_seed
void Ase::KeccakRng::auto_seed ()
function bit_capacity
inline size_t Ase::KeccakRng::bit_capacity () const
function discard
void Ase::KeccakRng::discard (
unsigned long long count
)
Discard count consecutive random values. This function is slightly faster than calling operator()() exactly count times.
function forget
void Ase::KeccakRng::forget ()
Discard 2^256 bits of the current generator state. This makes it practically infeasible to guess previous generator states or deduce generated values from the past. Use this for forward security Security03 of generated security tokens like session keys.
function generate
template<typename RandomAccessIterator>
inline void Ase::KeccakRng::generate (
RandomAccessIterator begin,
RandomAccessIterator end
)
function max
inline result_type Ase::KeccakRng::max () const
function min
inline result_type Ase::KeccakRng::min () const
function n_nums
inline size_t Ase::KeccakRng::n_nums () const
function operator()
inline result_type Ase::KeccakRng::operator() ()
function random
inline uint64_t Ase::KeccakRng::random ()
Generate uniformly distributed 64 bit pseudo random number. A new block permutation is carried out every n_nums() calls, see also xor_seed().
function seed [1/3]
inline void Ase::KeccakRng::seed (
uint64_t seed_value=1
)
function seed [2/3]
inline void Ase::KeccakRng::seed (
const uint64_t * seeds,
size_t n_seeds
)
function seed [3/3]
template<class SeedSeq>
inline void Ase::KeccakRng::seed (
SeedSeq & seed_sequence
)
function xor_seed
void Ase::KeccakRng::xor_seed (
const uint64_t * seeds,
size_t n_seeds
)
Incorporate seed_values into the current generator state. A block permutation to advance the generator state is carried out per n_nums() seed values. After calling this function, generating the next n_nums() random values will not need to block for a new permutation.
function ~KeccakRng
Ase::KeccakRng::~KeccakRng ()
Friends Documentation
friend operator!=
inline bool Ase::KeccakRng::operator!= (
const KeccakRng & lhs,
const KeccakRng & rhs
)
friend operator<<
template<typename CharT, typename Traits>
inline std::basic_ostream< CharT, Traits > & Ase::KeccakRng::operator<< (
std::basic_ostream< CharT, Traits > & os,
const KeccakRng & self
)
friend operator==
inline bool Ase::KeccakRng::operator== (
const KeccakRng & lhs,
const KeccakRng & rhs
)
friend operator>>
template<typename CharT, typename Traits>
inline std::basic_istream< CharT, Traits > & Ase::KeccakRng::operator>> (
std::basic_istream< CharT, Traits > & is,
KeccakRng & self
)
The documentation for this class was generated from the following file /__w/anklang/anklang/ase/randomhash.hh