crypto-random-effect-0.1.1: A random effect using crypto-random

Safe HaskellNone

Crypto.Random.Effect

Description

A Random effect.

Any ideas to let the user specify the random number generator (CPRG) instead of hardcoding SystemRNG without complicating the api and reinventing state as SetMember is very welcome.

Synopsis

Documentation

runRNG :: SetMember Lift (Lift IO) r => Eff (RNG :> (Reader EntropyPool :> r)) a -> Eff r aSource

Run the effect.

withRNG :: Member RNG r => (SystemRNG -> Eff r (a, SystemRNG)) -> Eff r aSource

withRandomBytes :: Member RNG r => Int -> (ByteString -> Eff r a) -> Eff r aSource

reexports from 'crypto-random'

class CPRG gen

Cryptographic Pseudo Random Generator

Instances

data SystemRNG

System entropy generator.

This generator doesn't use the entropy reseed level, as the only bytes generated are comping from the entropy pool already.

This generator doesn't create reproducible output, and might be difficult to use for testing and debugging purpose, but otherwise for real world use case should be fine.

data EntropyPool

Pool of Entropy. contains a self mutating pool of entropy, that is always guarantee to contains data.