packages feed

crypto-api 0.2 → 0.2.1

raw patch · 2 files changed

+27/−7 lines, 2 filesdep −filepathPVP ok

version bump matches the API change (PVP)

Dependencies removed: filepath

API changes (from Hackage documentation)

Files

Crypto/Random.hs view
@@ -36,7 +36,7 @@ -- |many generators have these error conditions in common data GenError = 	  GenErrorOther String	-- ^ Misc-	| RequestedTooManyBytes	-- ^ Requested more bytes than a single pass can generate (ex: genBytes g i | i > 2^(2^32))+	| RequestedTooManyBytes	-- ^ Requested more bytes than a single pass can generate (The maximum request is generator dependent) 	| RangeInvalid		-- ^ When using @genInteger g (l,h)@ and @logBase 2 (h - l) > (maxBound :: Int)@. 	| NeedReseed		-- ^ Some generators cease operation after too high a count without a reseed (ex: NIST SP 800-90) 	| NotEnoughEntropy	-- ^ For instantiating new generators (or reseeding)@@ -47,19 +47,37 @@ -- -- Minimum complete definition: `newGen`, `genSeedLength`, `genBytes`, `reseed`. class CryptoRandomGen g where-	-- |Instantiate a new random bit generator+	-- |Instantiate a new random bit generator.  The provided bytestring should+	-- be of length >= genSeedLength.  If the bytestring is shorter+	-- then the call may fail (suggested error: `NotEnoughEntropy`).  If the+	-- bytestring is of sufficent length the call should always succeed. 	newGen :: B.ByteString -> Either GenError g  	-- |Length of input entropy necessary to instantiate or reseed a generator 	genSeedLength :: Tagged g ByteLength -	-- |Obtain random data using a generator+	-- | @genBytes len g@ generates a random ByteString of length @len@ and new generator.+	-- The "MonadCryptoRandom" package has routines useful for converting the ByteString+	-- to commonly needed values (but "cereal" or other deserialization libraries would also work).+	--+	-- This routine can fail if the generator has gone too long without a reseed (usually this+	-- is in the ball-park of 2^48 requests).  Suggested error in this cases is `NeedReseed` 	genBytes	:: ByteLength -> g -> Either GenError (B.ByteString, g)  	-- |@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 our generated data is a secure random stream. 	--+	-- Some generators use @entropy@ to perturb the state of the generator, meaning:+	--+	-- @+	--     (_,g2') <- genBytesWithEntropy len g1 ent+	--     (_,g2 ) <- genBytes len g1+	--     g2 /= g2'+	-- @+	--+	-- But this is not required.+	-- 	-- Default: 	--  	-- @@@ -74,7 +92,10 @@ 				let entropy' = B.append entropy (B.replicate (len - B.length entropy) 0) 				in Right (zwp' entropy' bs, g') -	-- |reseed the generator+	-- |If the generator has produced too many random bytes on its existing seed+	-- it will throw `NeedReseed`.  In that case, reseed the generator using this function and+	-- a new high-entropy seed of length >= `genSeedLength`.  Using bytestrings that are too short+	-- can result in an error (`NotEnoughEntropy`). 	reseed		:: B.ByteString -> g -> Either GenError g  -- |Use "System.Crypto.Random" to obtain entropy for `newGen`.
crypto-api.cabal view
@@ -1,5 +1,5 @@ name:           crypto-api-version:        0.2+version:        0.2.1 license:        BSD3 license-file:   LICENSE copyright:      Thomas DuBuisson <thomas.dubuisson@gmail.com>, Dominic Steinitz (see Data.LargeWord module)@@ -52,8 +52,7 @@   Build-Depends: base == 4.*,                  bytestring >= 0.9 && < 0.10,                  cereal >= 0.2 && < 0.4,-                 tagged == 0.1.*,-                 filepath >= 1.1 && < 1.3+                 tagged == 0.1.*   ghc-options:   -O2   hs-source-dirs:   exposed-modules: Crypto.Classes, Crypto.Types, Crypto.HMAC, Data.LargeWord, Crypto.Modes, System.Crypto.Random, Crypto.Random, Crypto.Padding