cryptonite-0.9: Cryptography Primitives sink

License | BSD-style
Maintainer | Vincent Hanquez <vincent@snarc.org>
Stability | experimental
Portability | Good
Safe Haskell | None
Language | Haskell2010

Crypto.Random.Types

Description

Synopsis

- class (Functor m, Monad m) => MonadRandom m where
  - getRandomBytes :: ByteArray byteArray => Int -> m byteArray
- data MonadPseudoRandom gen a
- class DRG gen where
  - randomBytesGenerate :: ByteArray byteArray => Int -> gen -> (byteArray, gen)
- withDRG :: DRG gen => gen -> MonadPseudoRandom gen a -> (a, gen)

# Documentation

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

A monad constraint that allows to generate random bytes

Methods

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

Instances

MonadRandom IO |
DRG gen => MonadRandom (MonadPseudoRandom gen) |

data MonadPseudoRandom gen a

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

Instances

DRG gen => Monad (MonadPseudoRandom gen) |
DRG gen => Functor (MonadPseudoRandom gen) |
DRG gen => Applicative (MonadPseudoRandom gen) |
DRG gen => MonadRandom (MonadPseudoRandom gen) |

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

DRG ChaChaDRG |
DRG SystemDRG |

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

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