HashDRBGStream

The underlying stream-like interface for SystemEntropy.

TSHA: Any SHA-1 or SHA-2 digest type. Default is SHA512.

custom: The Hash_DRBG algorithm's personalization string. You can optionally set this to any specific value of your own choosing for improved security.

EntropyStream: The source of entropy from which to draw. The default is SystemEntropyStream!(), but can be overridden. If you provide your own, then it's your responsibility to ensure your entropy source is non-deterministic.

Because std.stream is pending a full replacement, be aware that stream-like random number generators currently use a temporary design that may change once a new std.stream is available.

Declaration:

struct HashDRBGStream(TSHA = SHA512, string custom = "D Crypto RNG", EntropyStream = SystemEntropyStream!())
	if(isInstanceOf!(SHA, TSHA))
	{...}

Members

Functions

read
void read(ubyte[] buf, ubyte[] overrideExtraInput)
void read(ubyte[] buf, Flag!"PredictionResistance" overridePredictionResistance)

Fills the buffer with random values using the Hash_DRBG algorithm.

read
void read(ubyte[] buf)
void read(ubyte[] buf, Flag!"PredictionResistance" overridePredictionResistance, ubyte[] overrideExtraInput)

Fills the buffer with random values using the Hash_DRBG algorithm.

Variables

extraInput
ubyte[] extraInput;

Further improve security by setting Hash_DRBG's optional "additional input" for each call to read(). This can be set to a new value before each read() call for maximum effect.

predictionResistance
Flag!"PredictionResistance" predictionResistance;

If your security needs are high enough that you'd rather risk blocking for an arbitrarily-long period of time while sufficient system entropy builds, than risk generating values from potentially insufficient entropy (ex, if you'd rather reseed from Linux's /dev/random than /dev/urandom), then set this to Yes.PredictionResistance. The next time a value is generated, the internal state will first be replenished with additional entropy, potentially from a blocking source.

Meta