Portability | unknown |
---|---|
Stability | stable |
Maintainer | Vincent 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
- make :: ByteString -> Either GenError AESRNG
- makeSystem :: IO AESRNG
- getRandomBytes :: AESRNG -> Int -> (ByteString, AESRNG)
Documentation
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.
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.