packages feed

cprng-aes 0.2.0 → 0.2.1

raw patch · 2 files changed

+17/−2 lines, 2 filesdep +randomPVP ok

version bump matches the API change (PVP)

Dependencies added: random

API changes (from Hackage documentation)

+ Crypto.Random.AESCtr: instance RandomGen AESRNG

Files

Crypto/Random/AESCtr.hs view
@@ -23,6 +23,7 @@ import Control.Applicative ((<$>))  import Crypto.Random+import System.Random (RandomGen(..)) import System.Crypto.Random (getEntropy) import qualified Crypto.Cipher.AES as AES @@ -30,7 +31,7 @@ import qualified Data.ByteString as B  import Data.Word-import Data.Bits (xor)+import Data.Bits (xor, (.&.)) import Data.Serialize  data Word128 = Word128 !Word64 !Word64@@ -114,3 +115,16 @@ 			where 				(r16, _)          = nextChunk rng 				(key2, cnt2, iv2) = makeParams b++instance RandomGen AESRNG where+	next rng =+		let (bs, rng') = nextChunk rng in+		let (Word128 a _) = get128 bs in+		let n = fromIntegral (a .&. 0x7fffffff) in+		(n, rng')+	split rng =+		let (bs, rng') = genRandomBytes rng 64 in+		case make bs of+			Left _      -> error "assert"+			Right rng'' -> (rng', rng'')+	genRange _ = (0, 0x7fffffff)
cprng-aes.cabal view
@@ -1,5 +1,5 @@ Name:                cprng-aes-Version:             0.2.0+Version:             0.2.1 Description:              Simple crypto pseudo-random-number-generator with really good randomness property.     .@@ -33,6 +33,7 @@ Library   Build-Depends:     base >= 3 && < 5                    , bytestring+                   , random                    , crypto-api >= 0.5                    , cryptocipher >= 0.2.5 && < 0.3.0                    , cereal >= 0.3.0 && < 0.4.0