add Crypto.Random abstraction interface

This commit is contained in:
Vincent Hanquez 2015-04-03 07:28:07 +01:00
parent ac77a20c06
commit abb470f8b7
2 changed files with 33 additions and 0 deletions

32
Crypto/Random.hs Normal file
View File

@ -0,0 +1,32 @@
-- Module : Crypto.Random
-- License : BSD-style
-- Maintainer : Vincent Hanquez <vincent@snarc.org>
-- Stability : stable
-- Portability : good
--
module Crypto.Random
(
-- * Deterministic instances
ChaChaDRG
-- * Deterministic Random class
, drgNew
, drgNewTest
, withDRG
, DRG(..)
-- * Random abstraction
, MonadRandom(..)
) where
import Crypto.Random.Types
import Crypto.Random.ChaChaDRG
import Crypto.Random.Entropy
import Crypto.Internal.Memory
import Control.Applicative
import Data.Word (Word64)
drgNew :: IO ChaChaDRG
drgNew = initialize <$> (getEntropy 40 :: IO SecureBytes)
drgNewTest :: (Word64, Word64, Word64, Word64, Word64) -> ChaChaDRG
drgNewTest = initializeWords

View File

@ -59,6 +59,7 @@ Library
Crypto.Hash.Tiger
Crypto.Hash.Whirlpool
Crypto.PubKey.Curve25519
Crypto.Random
Crypto.Random.Types
Crypto.Random.Entropy
Crypto.Random.EntropyPool