Crypto++
8.0
Free C++ class library of cryptographic schemes
|
Randomness Pool based on PGP 2.6.x with MDC. More...
Public Member Functions | |
OldRandomPool (unsigned int poolSize=384) | |
Construct an OldRandomPool. More... | |
bool | CanIncorporateEntropy () const |
Determines if a generator can accept additional entropy. More... | |
void | IncorporateEntropy (const byte *input, size_t length) |
Update RNG state with additional unpredictable values. More... | |
void | GenerateIntoBufferedTransformation (BufferedTransformation &target, const std::string &channel, lword size) |
Generate random bytes into a BufferedTransformation. More... | |
byte | GenerateByte () |
Generate new random byte and return it. More... | |
void | GenerateBlock (byte *output, size_t size) |
Generate random array of bytes. More... | |
![]() | |
virtual unsigned int | GenerateBit () |
Generate new random bit and return it. More... | |
virtual word32 | GenerateWord32 (word32 min=0, word32 max=0xffffffffUL) |
Generate a random 32 bit word in the range min to max, inclusive. More... | |
virtual void | DiscardBytes (size_t n) |
Generate and discard n bytes. More... | |
template<class IT > | |
void | Shuffle (IT begin, IT end) |
Randomly shuffle the specified array. More... | |
![]() | |
Algorithm (bool checkSelfTestStatus=true) | |
Interface for all crypto algorithms. More... | |
virtual std::string | AlgorithmName () const |
Provides the name of this algorithm. More... | |
virtual std::string | AlgorithmProvider () const |
Retrieve the provider of this algorithm. More... | |
![]() | |
virtual Clonable * | Clone () const |
Copies this object. More... | |
Randomness Pool based on PGP 2.6.x with MDC.
If you need the pre-Crypto++ 5.5 generator then use OldRandomPool class. The OldRandomPool class is always available so you dont need to define CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY. OldRandomPool also provides the modern interface, including CanIncorporateEntropy
, IncorporateEntropy
and GenerateIntoBufferedTransformation
.
You should migrate away from OldRandomPool at the earliest opportunity. Use a modern random number generator or key derivation function, like AutoSeededRandomPool or HKDF.
Definition at line 72 of file randpool.h.
OldRandomPool::OldRandomPool | ( | unsigned int | poolSize = 384 | ) |
Construct an OldRandomPool.
poolSize | internal pool size of the generator |
poolSize must be greater than 16
Definition at line 81 of file randpool.cpp.
|
inlinevirtual |
Determines if a generator can accept additional entropy.
Reimplemented from RandomNumberGenerator.
Definition at line 81 of file randpool.h.
|
virtual |
Update RNG state with additional unpredictable values.
input | the entropy to add to the generator |
length | the size of the input buffer |
NotImplemented |
A generator may or may not accept additional entropy. Call CanIncorporateEntropy() to test for the ability to use additional entropy.
If a derived class does not override IncorporateEntropy(), then the base class throws NotImplemented.
Reimplemented from RandomNumberGenerator.
Definition at line 89 of file randpool.cpp.
|
virtual |
Generate random bytes into a BufferedTransformation.
target | the BufferedTransformation object which receives the bytes |
channel | the channel on which the bytes should be pumped |
length | the number of bytes to generate |
The default implementation calls GenerateBlock() and pumps the result into the DEFAULT_CHANNEL of the target.
All generated values are uniformly distributed over the range specified within the the constraints of a particular generator.
Reimplemented from RandomNumberGenerator.
Definition at line 123 of file randpool.cpp.
|
virtual |
Generate new random byte and return it.
Default implementation calls GenerateBlock() with one byte.
All generated values are uniformly distributed over the range specified within the the constraints of a particular generator.
Reimplemented from RandomNumberGenerator.
Definition at line 135 of file randpool.cpp.
|
virtual |
Generate random array of bytes.
output | the byte buffer |
size | the length of the buffer, in bytes |
All generated values are uniformly distributed over the range specified within the the constraints of a particular generator.
Reimplemented from RandomNumberGenerator.
Definition at line 143 of file randpool.cpp.