cryptonite-0.21: Cryptography Primitives sink

LicenseBSD-style
MaintainerVincent Hanquez <vincent@snarc.org>
Stabilityexperimental
PortabilityGood
Safe HaskellNone
LanguageHaskell2010

Crypto.Random.Types

Description

 

Synopsis

Documentation

class (Functor m, Monad m) => MonadRandom m where Source #

A monad constraint that allows to generate random bytes

Minimal complete definition

getRandomBytes

Methods

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

Instances

MonadRandom IO Source # 

Methods

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

DRG gen => MonadRandom (MonadPseudoRandom gen) Source # 

Methods

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

data MonadPseudoRandom gen a Source #

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

Instances

DRG gen => Monad (MonadPseudoRandom gen) Source # 
DRG gen => Functor (MonadPseudoRandom gen) Source # 

Methods

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

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

DRG gen => Applicative (MonadPseudoRandom gen) Source # 
DRG gen => MonadRandom (MonadPseudoRandom gen) Source # 

Methods

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

class DRG gen where Source #

A Deterministic Random Generator (DRG) class

Minimal complete definition

randomBytesGenerate

Methods

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

Generate N bytes of randomness from a DRG

Instances

DRG SystemDRG Source # 

Methods

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

DRG ChaChaDRG Source # 

Methods

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

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

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