crypto-conduit 0.1.2 → 0.1.3.1
raw patch · 3 files changed
+25/−11 lines, 3 filesdep ~basedep ~bytestringdep ~cerealPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base, bytestring, cereal, conduit, crypto-api, transformers
API changes (from Hackage documentation)
- Crypto.Conduit: sinkHmac :: (Resource m, Hash ctx d) => MacKey -> Sink ByteString m d
+ Crypto.Conduit: sinkHmac :: (Resource m, Hash ctx d) => MacKey ctx d -> Sink ByteString m d
Files
- crypto-conduit.cabal +16/−8
- src/Crypto/Conduit.hs +8/−2
- tests/runtests.hs +1/−1
crypto-conduit.cabal view
@@ -1,6 +1,6 @@ Cabal-version: >= 1.8 Name: crypto-conduit-Version: 0.1.2+Version: 0.1.3.1 Synopsis: Conduit interface for cryptographic operations (from crypto-api). Homepage: https://github.com/meteficha/crypto-conduit License: BSD3@@ -23,6 +23,10 @@ Type: git Location: git://github.com/meteficha/crypto-conduit.git +Flag old-crypto-api+ Description: Use crypto-api < 0.9.+ Default: False+ Library Hs-Source-Dirs: src Exposed-modules:@@ -31,20 +35,24 @@ base >= 3 && < 5, bytestring >= 0.9 && < 0.10, cereal >= 0.3 && < 0.4,- crypto-api >= 0.8 && < 0.9, conduit >= 0.2 && < 0.3, transformers == 0.2.*+ if flag(old-crypto-api)+ Build-depends: crypto-api >= 0.8 && < 0.9+ CPP-options: -DOLD_CRYPTO_API+ else+ Build-depends: crypto-api >= 0.9 && < 0.10 GHC-options: -Wall Test-suite runtests Type: exitcode-stdio-1.0 Build-depends:- base >= 3 && < 5,- bytestring >= 0.9 && < 0.10,- cereal >= 0.3 && < 0.4,- crypto-api >= 0.8 && < 0.9,- conduit >= 0.2 && < 0.3,- transformers == 0.2.*,+ base,+ bytestring,+ cereal,+ crypto-api >= 0.9,+ conduit,+ transformers, cryptocipher == 0.3.*, cryptohash == 0.7.*,
src/Crypto/Conduit.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE BangPatterns #-}+{-# LANGUAGE BangPatterns, CPP #-} -- | This module contains wrappers for cryptographic functions -- using the @conduit@ package. Currently there is support for -- hashes, HMACs and many modes of block ciphers (but not@@ -110,7 +110,13 @@ -- | A 'Sink' that computes the HMAC of a stream of -- 'B.ByteString'@s@ and creates a digest @d@.-sinkHmac :: (Resource m, C.Hash ctx d) => C.MacKey -> Sink B.ByteString m d+sinkHmac :: (Resource m, C.Hash ctx d) =>+#if OLD_CRYPTO_API+ C.MacKey+#else+ C.MacKey ctx d+#endif+ -> Sink B.ByteString m d sinkHmac (C.MacKey key) = blocked AnyMultiple blockSize =$ sink where --------- Taken and modified from Crypto.HMAC:
tests/runtests.hs view
@@ -103,7 +103,7 @@ in d1 == d2 -prop_sinkHmac :: C.Hash ctx d => d -> C.MacKey -> L.ByteString -> Bool+prop_sinkHmac :: C.Hash ctx d => d -> C.MacKey ctx d -> L.ByteString -> Bool prop_sinkHmac d mackey input = let d1 = runPureResource $ sourceList (L.toChunks input) $$ sinkHmac mackey d2 = C.hmac mackey input `asTypeOf` d