Struct HashDRBGStream

The underlying stream-like interface for SystemEntropy.

Fields

Name Type Description
constant ubyte[seedSizeBytes]
entropySizeBytes void
extraInput ubyte[] 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.
inited bool
isUniformRandomStream void Mark this as a Rng Stream
maxGenerated int
nonceSizeBytes void
numGenerated uint
outputSizeBits void
predictionResistance Flag!"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.
value ubyte[seedSizeBytes+1]

Methods

Name Description
addHash
addHash
hashDerivation
incrementHash
init
read Fills the buffer with random values using the Hash_DRBG algorithm.
reseed

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))
	{...}

Authors

Copyright

License