Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add a 'reseedPeriod' function

  • Loading branch information...
commit e1d56659ee56abb3cb0b1d070d406d0de3f191e8 1 parent f5926f0
@TomMD authored
Showing with 8 additions and 4 deletions.
  1. +6 −2 Crypto/Random.hs
  2. +2 −2 crypto-api.cabal
View
8 Crypto/Random.hs
@@ -90,7 +90,7 @@ instance Exception GenError
-- requesting bytes
--
-- Minimum complete definition: `newGen`, `genSeedLength`, `genBytes`,
--- `reseed`.
+-- `reseed`, `reseedInfo`, `reseedPeriod`.
class CryptoRandomGen g where
-- |Instantiate a new random bit generator. The provided
-- bytestring should be of length >= genSeedLength. If the
@@ -114,9 +114,12 @@ class CryptoRandomGen g where
-- requests). Suggested error in this cases is `NeedReseed`
genBytes :: ByteLength -> g -> Either GenError (B.ByteString, g)
- -- |Indicates how soon a reseed is needed
+ -- | Indicates how soon a reseed is needed
reseedInfo :: g -> ReseedInfo
+ -- | Indicates the period between reseeds (constant for most generators).
+ reseedPeriod :: g -> ReseedInfo
+
-- |@genBytesWithEntropy g i entropy@ generates @i@ random
-- bytes and use the additional input @entropy@ in the
-- generation of the requested data to increase the confidence
@@ -211,6 +214,7 @@ instance CryptoRandomGen SystemRandom where
reseed _ _ = Left NeedsInfiniteSeed
newGenIO = getSystemGen
reseedInfo _ = Never
+ reseedPeriod _ = Never
-- | While the safety and wisdom of a splitting function depends on the
-- properties of the generator being split, several arguments from
View
4 crypto-api.cabal
@@ -1,5 +1,5 @@
name: crypto-api
-version: 0.11
+version: 0.12
license: BSD3
license-file: LICENSE
copyright: Thomas DuBuisson <thomas.dubuisson@gmail.com>
@@ -23,7 +23,7 @@ bug-reports: https://github.com/TomMD/crypto-api
stability: stable
build-type: Simple
cabal-version: >= 1.6
-tested-with: GHC == 7.2.2
+tested-with: GHC == 7.6.2
extra-source-files:
cbits/misc.c
cbits/misc.h
Please sign in to comment.
Something went wrong with that request. Please try again.