Portabilityportable, GHC
Stabilityexperimental
Maintainerrrnewton@gmail.com

Codec.Crypto.ConvertRNG

Description

This module bridges these three interfaces:

   Crypto.Classes.BlockCipher
   Crypto.Random.CryptoRandomGen
   System.Random.RandomGen

Specifically, a block cipher can be converted to generate a CryptoRandomGen, which in turn can be converted to provide the RandomGen interface.

Synopsis

Documentation

data BCtoCRG a

A BlockCipher can generate random numbers. When lifting we include a counter which increments as random numbers are generated:

Constructors

BCtoCRG a Word64 

Instances

BlockCipher x => CryptoRandomGen (BCtoCRG x) 

convertCRG :: CryptoRandomGen g => g -> CRGtoRG g

The constructor for CRGtoRG values.

data CRGtoRG a

Converting CryptoRandomGen to RandomGen. Keep a buffer of random bits and an index into that buffer.

Instances

CryptoRandomGen g => RandomGen (CRGtoRG g) 

data CRGtoRG0 a

Converting CryptoRandomGen to RandomGen. This naive version is probably pretty inefficent:

Constructors

CRGtoRG0 a 

Instances

CryptoRandomGen g => RandomGen (CRGtoRG0 g)