add Crypto.Random abstraction interface
This commit is contained in:
parent
ac77a20c06
commit
abb470f8b7
32
Crypto/Random.hs
Normal file
32
Crypto/Random.hs
Normal 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
|
||||||
@ -59,6 +59,7 @@ Library
|
|||||||
Crypto.Hash.Tiger
|
Crypto.Hash.Tiger
|
||||||
Crypto.Hash.Whirlpool
|
Crypto.Hash.Whirlpool
|
||||||
Crypto.PubKey.Curve25519
|
Crypto.PubKey.Curve25519
|
||||||
|
Crypto.Random
|
||||||
Crypto.Random.Types
|
Crypto.Random.Types
|
||||||
Crypto.Random.Entropy
|
Crypto.Random.Entropy
|
||||||
Crypto.Random.EntropyPool
|
Crypto.Random.EntropyPool
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user