cryptonite-0.29: Cryptography Primitives sink
LicenseBSD-style
MaintainerVincent Hanquez <vincent@snarc.org>
Stabilityexperimental
PortabilityGood
Safe HaskellNone
LanguageHaskell2010

Crypto.Random.Types

Description

 
Synopsis

Documentation

class Monad m => MonadRandom m where #

A monad constraint that allows to generate random bytes

Methods

getRandomBytes :: ByteArray byteArray => Int -> m byteArray #

Instances

Instances details
MonadRandom IO # 
Instance details

Defined in Crypto.Random.Types

Methods

getRandomBytes :: ByteArray byteArray => Int -> IO byteArray #

DRG gen => MonadRandom (MonadPseudoRandom gen) # 
Instance details

Defined in Crypto.Random.Types

Methods

getRandomBytes :: ByteArray byteArray => Int -> MonadPseudoRandom gen byteArray #

data MonadPseudoRandom gen a #

A simple Monad class very similar to a State Monad with the state being a DRG.

Instances

Instances details
DRG gen => Monad (MonadPseudoRandom gen) # 
Instance details

Defined in Crypto.Random.Types

Methods

(>>=) :: MonadPseudoRandom gen a -> (a -> MonadPseudoRandom gen b) -> MonadPseudoRandom gen b #

(>>) :: MonadPseudoRandom gen a -> MonadPseudoRandom gen b -> MonadPseudoRandom gen b #

return :: a -> MonadPseudoRandom gen a #

DRG gen => Functor (MonadPseudoRandom gen) # 
Instance details

Defined in Crypto.Random.Types

Methods

fmap :: (a -> b) -> MonadPseudoRandom gen a -> MonadPseudoRandom gen b #

(<$) :: a -> MonadPseudoRandom gen b -> MonadPseudoRandom gen a #

DRG gen => Applicative (MonadPseudoRandom gen) # 
Instance details

Defined in Crypto.Random.Types

Methods

pure :: a -> MonadPseudoRandom gen a #

(<*>) :: MonadPseudoRandom gen (a -> b) -> MonadPseudoRandom gen a -> MonadPseudoRandom gen b #

liftA2 :: (a -> b -> c) -> MonadPseudoRandom gen a -> MonadPseudoRandom gen b -> MonadPseudoRandom gen c #

(*>) :: MonadPseudoRandom gen a -> MonadPseudoRandom gen b -> MonadPseudoRandom gen b #

(<*) :: MonadPseudoRandom gen a -> MonadPseudoRandom gen b -> MonadPseudoRandom gen a #

DRG gen => MonadRandom (MonadPseudoRandom gen) # 
Instance details

Defined in Crypto.Random.Types

Methods

getRandomBytes :: ByteArray byteArray => Int -> MonadPseudoRandom gen byteArray #

class DRG gen where #

A Deterministic Random Generator (DRG) class

Methods

randomBytesGenerate :: ByteArray byteArray => Int -> gen -> (byteArray, gen) #

Generate N bytes of randomness from a DRG

Instances

Instances details
DRG SystemDRG # 
Instance details

Defined in Crypto.Random.SystemDRG

Methods

randomBytesGenerate :: ByteArray byteArray => Int -> SystemDRG -> (byteArray, SystemDRG) #

DRG ChaChaDRG # 
Instance details

Defined in Crypto.Random.ChaChaDRG

Methods

randomBytesGenerate :: ByteArray byteArray => Int -> ChaChaDRG -> (byteArray, ChaChaDRG) #

withDRG :: DRG gen => gen -> MonadPseudoRandom gen a -> (a, gen) #

Run a pure computation with a Deterministic Random Generator in the MonadPseudoRandom