ChaCha Deterministic Random Generator
Modulecryptonite-0.30Haskell2010
Crypto.Random
Synopsis
- newtype ChaChaDRG
- data SystemDRG
- newtype Seed
- value seedNew
- value seedFromInteger
- value seedToInteger
- value seedFromBinary
- value getSystemDRG
- value drgNew
- value drgNewSeed
- value drgNewTest
- value withDRG
- value withRandomBytes
- class DRG
- class MonadRandom
- newtype MonadPseudoRandom
- Packagecryptonite-0.30
- Exports16
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourceChaChaDRG.hs
Deterministic instances
A referentially transparent System representation of the random evaluated out of the system.
Holding onto a specific DRG means that all the already evaluated bytes will be consistently replayed.
There's no need to reseed this DRG, as only pure entropy is represented here.
Instances1ByteArrayAccess
ByteArrayAccess SeedDefined in cryptonite-0.30 · Crypto.Random
Seed
Create a new Seed from system entropy
Convert an integer to a Seed
Convert a Seed to an integer
Convert a binary to a seed
Deterministic Random class
Grab one instance of the System DRG
Create a new DRG from system entropy
Create a new DRG from a seed
Create a new DRG from 5 Word64.
This is a convenient interface to create deterministic interface for quickcheck style testing.
It can also be used in other contexts provided the input has been properly randomly generated.
Note that the Arbitrary instance provided by QuickCheck for Word64 does
not have a uniform distribution. It is often better to use instead
arbitraryBoundedRandom.
System endianness impacts how the tuple is interpreted and therefore changes the resulting DRG.
Run a pure computation with a Deterministic Random Generator in the MonadPseudoRandom
Generate len random bytes and mapped the bytes to the function f.
This is equivalent to use Control.Arrow first with randomBytesGenerate
A Deterministic Random Generator (DRG) class
Methods
randomBytesGenerate :: ByteArray byteArray => Int -> gen -> (byteArray, gen)Generate N bytes of randomness from a DRG
Random abstraction
A monad constraint that allows to generate random bytes
Methods
getRandomBytes :: ByteArray byteArray => Int -> m byteArray
Instances2MonadRandom
MonadRandom IODefined in cryptonite-0.30 · Crypto.Random.TypesDRG gen => MonadRandom (MonadPseudoRandom gen)Defined in cryptonite-0.30 · Crypto.Random.Types
A simple Monad class very similar to a State Monad with the state being a DRG.
Instances4Monad, Functor, Applicative, MonadRandom
DRG gen => Monad (MonadPseudoRandom gen)Defined in cryptonite-0.30 · Crypto.Random.TypesDRG gen => Functor (MonadPseudoRandom gen)Defined in cryptonite-0.30 · Crypto.Random.TypesDRG gen => Applicative (MonadPseudoRandom gen)Defined in cryptonite-0.30 · Crypto.Random.TypesDRG gen => MonadRandom (MonadPseudoRandom gen)Defined in cryptonite-0.30 · Crypto.Random.Types