Botan

RandomNumberGenerator

License
Botan is released under the Simplified BSD License (see LICENSE.md)

abstract class  RandomNumberGenerator;

This class represents a random number (RNG) generator object.


static RandomNumberGenerator  makeRng();

Create a seeded and active RNG object for general application use Added in 1.8.0


static RandomNumberGenerator  makeRng(AlgorithmFactory af);

Create a seeded and active RNG object for general application use Added in 1.11.5


abstract void  randomize(ubyte* output, size_t length);

Randomize a ubyte array.

Parameters
ubyte* output the ubyte array to hold the random output.
size_t length the length of the ubyte array output.

abstract SecureVector!ubyte  randomVec(size_t bytes);

Return a random vector

Parameters
size_t bytes number of bytes in the result
Returns
randomized vector of length bytes

final ubyte  nextByte();

Return a random ubyte

Returns
random ubyte

abstract const bool  isSeeded();

Check whether this RNG is seeded.

Returns
true if this RNG was already seeded, false otherwise.

abstract void  clear();

Clear all internally held values of this RNG.


abstract const @property string  name();

Return the  name of this object


abstract void  reseed(size_t bits_to_collect);

Seed this RNG using the entropy sources it contains.

Parameters
size_t bits_to_collect is the number of bits of entropy to attempt to gather from the entropy sources

abstract void  addEntropy(const(ubyte)* input, size_t length);

Add entropy to this RNG.

Parameters
const(ubyte)* input a ubyte array containg the entropy to be added
size_t length the length of the ubyte array in

abstract class  NullRNG: botan.rng.rng.RandomNumberGenerator;

Null/stub RNG - fails if you try to use it for anything


class  SerializedRNG: botan.rng.rng.RandomNumberGenerator;

Wraps access to a RNG in a mutex