-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Simple random generators API for cryptography related code
--
-- Simple random generators API for cryptography related code
@package crypto-random-api
@version 0.1.0
module Crypto.Random.API
-- | A class of Cryptographic Secure Random generator.
--
-- The main difference with the generic haskell RNG is that it return
-- bytes instead of integer.
--
-- It is quite similar to the CryptoRandomGen class in crypto-api except
-- that error are not returned to the user. Instead the user is suppose
-- to handle reseeding by using the NeedReseed and SupplyEntropy methods.
-- For other type of errors, the user is expect to generate bytes with
-- the parameters bounds explicity defined here.
--
-- The CPRG need to be able to generate up to 2^20 bytes in one call,
class CPRG g
cprgNeedReseed :: CPRG g => g -> Int
cprgSupplyEntropy :: CPRG g => g -> ByteString -> g
cprgGenBytes :: CPRG g => g -> Int -> (ByteString, g)
-- | Generate bytes using the cprg in parameter.
--
-- arbitrary limit the number of bytes that can be generated in one go to
-- 10mb.
genRandomBytes :: CPRG g => g -> Int -> (ByteString, g)
-- | this is equivalent to using Control.Arrow first with
-- genBytes.
--
-- namely it generate len bytes and map the bytes to the function
-- f
withRandomBytes :: CPRG g => g -> Int -> (ByteString -> a) -> (a, g)
-- | Return system entropy using the entropy package getEntropy
getSystemEntropy :: Int -> IO ByteString