Portability | unknown |
---|---|
Stability | stable |
Maintainer | Vincent Hanquez <vincent@snarc.org> |
Safe Haskell | None |
this CPRNG is an AES 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:
aes (IV xor
counter) -> 16 bytes output
- data AESRNG
- make :: ByteString -> Maybe AESRNG
- makeSystem :: IO AESRNG
- genRandomBytes :: CPRG g => Int -> g -> (ByteString, g)
Documentation
make :: ByteString -> Maybe AESRNGSource
make an AES RNG from a bytestring seed. 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.
use makeSystem
to not have to deal with the generator seed.
Initialize a new AES RNG using the system entropy.
:: CPRG g | |
=> Int | number of bytes to return |
-> g | CPRG to use |
-> (ByteString, g) |
Generate bytes using the cprg in parameter.
If the number of bytes requested is really high,
it's preferable to use genRandomBytes
for better memory efficiency.