cprng-aes-0.1.0: Crypto Pseudo Random Number Generator using AES in counter mode.

MaintainerVincent Hanquez <vincent@snarc.org>



this CPRNG is an AES cbc based counter system.

the internal size of fields are: 16 bytes IV, 16 bytes counter, 32 bytes key

each block are generated the following way: (IV xor counter) aes key -> 16 bytes output



data AESRNG Source

An opaque object containing an AES CPRNG

make :: ByteString -> Either GenError AESRNGSource

make an AESRNG from a bytestring. the bytestring need to be at least 64 bytes. if the bytestring is longer, the extra bytes will be ignored and will not take part in the initialization.

makeSystem :: IO AESRNGSource

Initialize a new AESRng using the system entropy.

getRandomBytes :: AESRNG -> Int -> (ByteString, AESRNG)Source

get a Random number of bytes from the RNG. for efficienty and not wasted any randomness, it's better to generate bytes on multiple of 16, however it will works for any size.