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

Safe Haskell | None
Language | Haskell2010

Crypto.Random.DRBG.CTR

Synopsis

- data State a
- getCounter :: State a -> Word64
- reseedInterval :: Word64
- update :: BlockCipher a => ByteString -> State a -> Maybe (State a)
- instantiate :: BlockCipher a => Entropy -> PersonalizationString -> Maybe (State a)
- reseed :: BlockCipher a => State a -> Entropy -> AdditionalInput -> Maybe (State a)
- generate :: BlockCipher a => State a -> ByteLength -> AdditionalInput -> Maybe (RandomBits, State a)

# Documentation

data State a Source #

Instances

Serialize a => Serialize (State a) Source # |
Methods put :: Putter (State a) # get :: Get (State a) #

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.