crypto-random 0.0.7 → 0.0.8
raw patch · 4 files changed
+10/−1 lines, 4 filesdep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
+ Crypto.Random: instance Typeable SystemRNG
Files
- Crypto/Random.hs +3/−0
- Crypto/Random/Entropy.hs +3/−0
- Crypto/Random/Test.hs +3/−0
- crypto-random.cabal +1/−1
Crypto/Random.hs view
@@ -9,6 +9,7 @@ -- random generator. -- {-# LANGUAGE ExistentialQuantification #-}+{-# LANGUAGE DeriveDataTypeable #-} module Crypto.Random ( -- * Entropy@@ -28,6 +29,7 @@ import Crypto.Random.Entropy import Crypto.Random.Generator import Data.ByteString (ByteString)+import Data.Typeable (Typeable) import qualified Data.ByteString.Internal as B (unsafeCreate) -- | System entropy generator.@@ -39,6 +41,7 @@ -- use for testing and debugging purpose, but otherwise for real world use case -- should be fine. data SystemRNG = SystemRNG EntropyPool+ deriving Typeable instance CPRG SystemRNG where cprgCreate entPool = SystemRNG entPool
Crypto/Random/Entropy.hs view
@@ -7,6 +7,7 @@ -- {-# LANGUAGE CPP #-} {-# LANGUAGE ExistentialQuantification #-}+{-# LANGUAGE DeriveDataTypeable #-} module Crypto.Random.Entropy ( EntropyPool , createEntropyPool@@ -21,6 +22,7 @@ import System.IO.Unsafe (unsafePerformIO) import Data.Maybe (catMaybes) import Data.SecureMem+import Data.Typeable (Typeable) import Data.ByteString (ByteString) import qualified Data.ByteString as B import qualified Data.ByteString.Internal as B@@ -80,6 +82,7 @@ -- | Pool of Entropy. contains a self mutating pool of entropy, -- that is always guarantee to contains data. data EntropyPool = EntropyPool [EntropyBackend] (MVar Int) SecureMem+ deriving Typeable -- size of entropy pool by default defaultPoolSize :: Int
Crypto/Random/Test.hs view
@@ -7,6 +7,8 @@ -- -- Provide way to test usual simple statisticals test for randomness --+{-# LANGUAGE GADTs #-}+ module Crypto.Random.Test ( RandomTestState , RandomTestResult(..)@@ -50,6 +52,7 @@ let (b1,b2) = L.splitAt monteN bs mapM_ (addVec 1 . fromIntegral) $ L.unpack b1 loop b2+ addVec :: Word64 -> Int -> IO () addVec a i = M.read buckets i >>= \d -> M.write buckets i $! d+a -- | Finalize random test state into some result
crypto-random.cabal view
@@ -1,5 +1,5 @@ Name: crypto-random-Version: 0.0.7+Version: 0.0.8 Description: Simple cryptographic random related types License: BSD3 License-file: LICENSE