DRBG-0.5.5: Deterministic random bit generator (aka RNG, PRNG) based HMACs, Hashes, and Ciphers.

Safe HaskellNone




data State a Source


getCounter :: State a -> Word64 Source

Get a count of how many times this generator has been used since instantiation or reseed.

reseedInterval :: Word64 Source

The reseed interval

update :: BlockCipher a => ByteString -> State a -> Maybe (State a) Source

Update the RNG

instantiate :: BlockCipher a => Entropy -> PersonalizationString -> Maybe (State a) Source

Instantiate a new CTR based counter. This assumes the block cipher is safe for generating 2^48 seperate bitstrings (e.g. For SP800-90 we assume AES and not 3DES)

reseed :: BlockCipher a => State a -> Entropy -> AdditionalInput -> Maybe (State a) Source

reseed oldRNG entropy additionalInfo

Reseed a DRBG with some entropy (ent must be at least seedlength, which is the block length plus the key length)

generate :: BlockCipher a => State a -> ByteLength -> AdditionalInput -> Maybe (RandomBits, State a) Source

Generate new bytes of data, stepping the generator.