Permalink
Browse files

add signature

  • Loading branch information...
1 parent 10c093a commit 32d1e8d615925c837c98386725f62a6427a92e1f @vincenthz committed Dec 2, 2012
Showing with 2 additions and 0 deletions.
  1. +2 −0 Crypto/Random/AESCtr.hs
View
@@ -148,6 +148,7 @@ genNextChunk (RNG iv counter sz key) = (chunk, newrng)
bytes = put128 (iv `xor128` counter)
#endif
+getRNGReseedLimit :: RNG -> Int
getRNGReseedLimit (RNG _ _ sz _)
| sz >= limit = 0
| otherwise = fromIntegral (limit - sz)
@@ -180,6 +181,7 @@ genRanBytes rng n
(b1, b2) = B.splitAt n b
in (b1, rng { aesrngState = rng', aesrngCache = b2 })
+reseedState :: ByteString -> RNG -> RNG
reseedState b rng@(RNG _ cnt1 _ _) = RNG (get128 r16 `xor128` get128 iv2) (cnt1 `xor128` get128 cnt2) 0 key2
where (r16, _) = genNextChunk rng
(key2, cnt2, iv2) = makeParams b

0 comments on commit 32d1e8d

Please sign in to comment.