cryptohash 0.9.1 → 0.10.0
raw patch · 17 files changed
+21/−509 lines, 17 filesdep −cerealdep −crypto-apidep −taggedPVP ok
version bump matches the API change (PVP)
Dependencies removed: cereal, crypto-api, tagged
API changes (from Hackage documentation)
- Crypto.Hash.MD2: data MD2
- Crypto.Hash.MD2: instance Eq MD2
- Crypto.Hash.MD2: instance Hash Ctx MD2
- Crypto.Hash.MD2: instance Ord MD2
- Crypto.Hash.MD2: instance Serialize MD2
- Crypto.Hash.MD2: instance Show MD2
- Crypto.Hash.MD4: data MD4
- Crypto.Hash.MD4: instance Eq MD4
- Crypto.Hash.MD4: instance Hash Ctx MD4
- Crypto.Hash.MD4: instance Ord MD4
- Crypto.Hash.MD4: instance Serialize MD4
- Crypto.Hash.MD4: instance Show MD4
- Crypto.Hash.MD5: data MD5
- Crypto.Hash.MD5: instance Eq MD5
- Crypto.Hash.MD5: instance Hash Ctx MD5
- Crypto.Hash.MD5: instance Ord MD5
- Crypto.Hash.MD5: instance Serialize MD5
- Crypto.Hash.MD5: instance Show MD5
- Crypto.Hash.RIPEMD160: data RIPEMD160
- Crypto.Hash.RIPEMD160: instance Eq RIPEMD160
- Crypto.Hash.RIPEMD160: instance Hash Ctx RIPEMD160
- Crypto.Hash.RIPEMD160: instance Ord RIPEMD160
- Crypto.Hash.RIPEMD160: instance Serialize RIPEMD160
- Crypto.Hash.RIPEMD160: instance Show RIPEMD160
- Crypto.Hash.SHA1: data SHA1
- Crypto.Hash.SHA1: instance Eq SHA1
- Crypto.Hash.SHA1: instance Hash Ctx SHA1
- Crypto.Hash.SHA1: instance Ord SHA1
- Crypto.Hash.SHA1: instance Serialize SHA1
- Crypto.Hash.SHA1: instance Show SHA1
- Crypto.Hash.SHA224: data SHA224
- Crypto.Hash.SHA224: instance Eq SHA224
- Crypto.Hash.SHA224: instance Hash Ctx SHA224
- Crypto.Hash.SHA224: instance Ord SHA224
- Crypto.Hash.SHA224: instance Serialize SHA224
- Crypto.Hash.SHA224: instance Show SHA224
- Crypto.Hash.SHA256: data SHA256
- Crypto.Hash.SHA256: instance Eq SHA256
- Crypto.Hash.SHA256: instance Hash Ctx SHA256
- Crypto.Hash.SHA256: instance Ord SHA256
- Crypto.Hash.SHA256: instance Serialize SHA256
- Crypto.Hash.SHA256: instance Show SHA256
- Crypto.Hash.SHA3: data SHA3
- Crypto.Hash.SHA3: instance Eq SHA3
- Crypto.Hash.SHA3: instance Hash Ctx SHA3
- Crypto.Hash.SHA3: instance Ord SHA3
- Crypto.Hash.SHA3: instance Serialize SHA3
- Crypto.Hash.SHA3: instance Show SHA3
- Crypto.Hash.SHA384: data SHA384
- Crypto.Hash.SHA384: instance Eq SHA384
- Crypto.Hash.SHA384: instance Hash Ctx SHA384
- Crypto.Hash.SHA384: instance Ord SHA384
- Crypto.Hash.SHA384: instance Serialize SHA384
- Crypto.Hash.SHA384: instance Show SHA384
- Crypto.Hash.SHA512: data SHA512
- Crypto.Hash.SHA512: instance Eq SHA512
- Crypto.Hash.SHA512: instance Hash Ctx SHA512
- Crypto.Hash.SHA512: instance Ord SHA512
- Crypto.Hash.SHA512: instance Serialize SHA512
- Crypto.Hash.SHA512: instance Show SHA512
- Crypto.Hash.Skein256: data Skein256
- Crypto.Hash.Skein256: instance Eq Skein256
- Crypto.Hash.Skein256: instance Hash Ctx Skein256
- Crypto.Hash.Skein256: instance Ord Skein256
- Crypto.Hash.Skein256: instance Serialize Skein256
- Crypto.Hash.Skein256: instance Show Skein256
- Crypto.Hash.Skein512: data Skein512
- Crypto.Hash.Skein512: instance Eq Skein512
- Crypto.Hash.Skein512: instance Hash Ctx Skein512
- Crypto.Hash.Skein512: instance Ord Skein512
- Crypto.Hash.Skein512: instance Serialize Skein512
- Crypto.Hash.Skein512: instance Show Skein512
- Crypto.Hash.Tiger: data Tiger
- Crypto.Hash.Tiger: instance Eq Tiger
- Crypto.Hash.Tiger: instance Hash Ctx Tiger
- Crypto.Hash.Tiger: instance Ord Tiger
- Crypto.Hash.Tiger: instance Serialize Tiger
- Crypto.Hash.Tiger: instance Show Tiger
- Crypto.Hash.Whirlpool: data Whirlpool
- Crypto.Hash.Whirlpool: instance Eq Whirlpool
- Crypto.Hash.Whirlpool: instance Hash Ctx Whirlpool
- Crypto.Hash.Whirlpool: instance Ord Whirlpool
- Crypto.Hash.Whirlpool: instance Serialize Whirlpool
- Crypto.Hash.Whirlpool: instance Show Whirlpool
Files
- Bench/BenchAPI.hs +4/−10
- Crypto/Hash/MD2.hs +1/−35
- Crypto/Hash/MD4.hs +1/−35
- Crypto/Hash/MD5.hs +1/−35
- Crypto/Hash/RIPEMD160.hs +1/−35
- Crypto/Hash/SHA1.hs +1/−35
- Crypto/Hash/SHA224.hs +1/−35
- Crypto/Hash/SHA256.hs +1/−35
- Crypto/Hash/SHA3.hs +1/−35
- Crypto/Hash/SHA384.hs +1/−35
- Crypto/Hash/SHA512.hs +1/−35
- Crypto/Hash/Skein256.hs +1/−35
- Crypto/Hash/Skein512.hs +1/−35
- Crypto/Hash/Tiger.hs +1/−35
- Crypto/Hash/Types.hs +1/−0
- Crypto/Hash/Whirlpool.hs +1/−35
- cryptohash.cabal +2/−9
Bench/BenchAPI.hs view
@@ -1,25 +1,23 @@ {-# LANGUAGE BangPatterns #-} import Criterion.Main+import Data.Byteable import qualified Data.ByteString as B import qualified Data.ByteString.Lazy as L import qualified Crypto.Hash.SHA1 as SHA1 import qualified Crypto.Hash.SHA512 as SHA512 import qualified Crypto.Hash.SHA3 as SHA3 import Crypto.Hash-import qualified Crypto.Classes as CAPI sha1F = ( "sha1" , SHA1.hash , SHA1.finalize . SHA1.update SHA1.init- , digestToByteString . (hash :: B.ByteString -> Digest SHA1)- , CAPI.hash' :: B.ByteString -> SHA1.SHA1+ , toBytes . (hash :: B.ByteString -> Digest SHA1) ) sha512F = ( "sha512" , SHA512.hash , SHA512.finalize . SHA512.update SHA512.init- , digestToByteString . (hash :: B.ByteString -> Digest SHA512)- , CAPI.hash' :: B.ByteString -> SHA512.SHA512+ , toBytes . (hash :: B.ByteString -> Digest SHA512) ) main = do@@ -30,7 +28,7 @@ let !lbs64x256 = (map (const (B.replicate 64 0)) [0..3]) !lbs64x4096 = (map (const (B.replicate 64 0)) [0..63]) - let (fname, fHash, fIncr, fAPI, fCAPI) = sha512F+ let (fname, fHash, fIncr, fAPI) = sha512F let benchName ty z = fname ++ "." ++ ty ++ " " ++ show z defaultMain [ bgroup "digest hex"@@ -40,25 +38,21 @@ [ bench (benchName "hash" 0) $ whnf fHash B.empty , bench (benchName "incr" 0) $ whnf fIncr B.empty , bench (benchName "api" 0) $ whnf fAPI B.empty- , bench (benchName "capi" 0) $ whnf fCAPI B.empty ] , bcompare [ bench (benchName "hash" 32) $ whnf SHA1.hash bs32 , bench (benchName "incr" 32) $ whnf fIncr bs32 , bench (benchName "api" 32) $ whnf fAPI bs32- , bench (benchName "capi" 32) $ whnf fCAPI bs32 ] , bcompare [ bench (benchName "hash" 256) $ whnf SHA1.hash bs256 , bench (benchName "incr" 256) $ whnf fIncr bs256 , bench (benchName "api" 256) $ whnf fAPI bs256- , bench (benchName "capi" 256) $ whnf fCAPI bs256 ] , bcompare [ bench (benchName "hash" 4096) $ whnf SHA1.hash bs4096 , bench (benchName "incr" 4096) $ whnf fIncr bs4096 , bench (benchName "api" 4096) $ whnf fAPI bs4096- , bench (benchName "capi" 4096) $ whnf fCAPI bs4096 ] ] where hashsha1 = hash :: B.ByteString -> Digest SHA1
Crypto/Hash/MD2.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE ForeignFunctionInterface, CPP, MultiParamTypeClasses #-}+{-# LANGUAGE ForeignFunctionInterface #-} -- | -- Module : Crypto.Hash.MD2@@ -11,7 +11,6 @@ -- module Crypto.Hash.MD2 ( Ctx(..)- , MD2 -- * Incremental hashing Functions , init -- :: Ctx@@ -37,40 +36,7 @@ import Data.Word import Crypto.Hash.Internal (unsafeDoIO) -#ifdef HAVE_CRYPTOAPI--import Control.Monad (liftM)-import Data.Serialize (Serialize(..))-import Data.Serialize.Get (getByteString)-import Data.Serialize.Put (putByteString)-import Data.Tagged (Tagged(..))-import qualified Crypto.Classes as C (Hash(..))--instance C.Hash Ctx MD2 where- outputLength = Tagged (16 * 8)- blockLength = Tagged (16 * 8)- initialCtx = init- updateCtx = update- finalize ctx bs = Digest . finalize $ update ctx bs--instance Serialize MD2 where- get = liftM Digest (getByteString digestSize)- put (Digest d) = putByteString d--#endif- newtype Ctx = Ctx ByteString--{-# DEPRECATED MD2- ["Future cryptohash versions will not export crypto-api hash instances here."- ,"you can either :"- ," - carry using cryptoapi types and definitions by using the"- ," cryptohash-cryptoapi package and importing Crypto.Hash.CryptoAPI"- ," instead of Crypto.Hash.MD2."- ," - use cryptohash's centralized API by importing Crypto.Hash"- ] #-}-data MD2 = Digest !ByteString- deriving (Eq,Ord,Show) {-# INLINE digestSize #-} digestSize :: Int
Crypto/Hash/MD4.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE ForeignFunctionInterface, CPP, MultiParamTypeClasses #-}+{-# LANGUAGE ForeignFunctionInterface #-} -- | -- Module : Crypto.Hash.MD4@@ -11,7 +11,6 @@ -- module Crypto.Hash.MD4 ( Ctx(..)- , MD4 -- * Incremental hashing Functions , init -- :: Ctx@@ -37,40 +36,7 @@ import Data.Word import Crypto.Hash.Internal (unsafeDoIO) -#ifdef HAVE_CRYPTOAPI--import Control.Monad (liftM)-import Data.Serialize (Serialize(..))-import Data.Serialize.Get (getByteString)-import Data.Serialize.Put (putByteString)-import Data.Tagged (Tagged(..))-import qualified Crypto.Classes as C (Hash(..))--instance C.Hash Ctx MD4 where- outputLength = Tagged (16 * 8)- blockLength = Tagged (64 * 8)- initialCtx = init- updateCtx = update- finalize ctx bs = Digest . finalize $ update ctx bs--instance Serialize MD4 where- get = liftM Digest (getByteString digestSize)- put (Digest d) = putByteString d--#endif- newtype Ctx = Ctx ByteString--{-# DEPRECATED MD4- ["Future cryptohash versions will not export crypto-api hash instances here."- ,"you can either :"- ," - carry using cryptoapi types and definitions by using the"- ," cryptohash-cryptoapi package and importing Crypto.Hash.CryptoAPI"- ," instead of Crypto.Hash.MD4."- ," - use cryptohash's centralized API by importing Crypto.Hash"- ] #-}-data MD4 = Digest !ByteString- deriving (Eq,Ord,Show) {-# INLINE digestSize #-} digestSize :: Int
Crypto/Hash/MD5.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE ForeignFunctionInterface, CPP, MultiParamTypeClasses #-}+{-# LANGUAGE ForeignFunctionInterface #-} -- | -- Module : Crypto.Hash.MD5@@ -11,7 +11,6 @@ -- module Crypto.Hash.MD5 ( Ctx(..)- , MD5 -- * Incremental hashing Functions , init -- :: Ctx@@ -37,40 +36,7 @@ import Data.Word import Crypto.Hash.Internal (unsafeDoIO) -#ifdef HAVE_CRYPTOAPI--import Control.Monad (liftM)-import Data.Serialize (Serialize(..))-import Data.Serialize.Get (getByteString)-import Data.Serialize.Put (putByteString)-import Data.Tagged (Tagged(..))-import qualified Crypto.Classes as C (Hash(..))--instance C.Hash Ctx MD5 where- outputLength = Tagged (16 * 8)- blockLength = Tagged (64 * 8)- initialCtx = init- updateCtx = update- finalize ctx bs = Digest . finalize $ update ctx bs--instance Serialize MD5 where- get = liftM Digest (getByteString digestSize)- put (Digest d) = putByteString d--#endif- newtype Ctx = Ctx ByteString--{-# DEPRECATED MD5- ["Future cryptohash versions will not export crypto-api hash instances here."- ,"you can either :"- ," - carry using cryptoapi types and definitions by using the"- ," cryptohash-cryptoapi package and importing Crypto.Hash.CryptoAPI"- ," instead of Crypto.Hash.MD5."- ," - use cryptohash's centralized API by importing Crypto.Hash"- ] #-}-data MD5 = Digest !ByteString- deriving (Eq,Ord,Show) {-# INLINE digestSize #-} digestSize :: Int
Crypto/Hash/RIPEMD160.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE ForeignFunctionInterface, CPP, MultiParamTypeClasses #-}+{-# LANGUAGE ForeignFunctionInterface #-} -- | -- Module : Crypto.Hash.RIPEMD160@@ -11,7 +11,6 @@ -- module Crypto.Hash.RIPEMD160 ( Ctx(..)- , RIPEMD160 -- * Incremental hashing Functions , init -- :: Ctx@@ -37,40 +36,7 @@ import Data.Word import Crypto.Hash.Internal (unsafeDoIO) -#ifdef HAVE_CRYPTOAPI--import Control.Monad (liftM)-import Data.Serialize (Serialize(..))-import Data.Serialize.Get (getByteString)-import Data.Serialize.Put (putByteString)-import Data.Tagged (Tagged(..))-import qualified Crypto.Classes as C (Hash(..))--instance C.Hash Ctx RIPEMD160 where- outputLength = Tagged (20 * 8)- blockLength = Tagged (64 * 8)- initialCtx = init- updateCtx = update- finalize ctx bs = Digest . finalize $ update ctx bs--instance Serialize RIPEMD160 where- get = liftM Digest (getByteString digestSize)- put (Digest d) = putByteString d--#endif- newtype Ctx = Ctx ByteString--{-# DEPRECATED RIPEMD160- ["Future cryptohash versions will not export crypto-api hash instances here."- ,"you can either :"- ," - carry using cryptoapi types and definitions by using the"- ," cryptohash-cryptoapi package and importing Crypto.Hash.CryptoAPI"- ," instead of Crypto.Hash.RIPEMD160."- ," - use cryptohash's centralized API by importing Crypto.Hash"- ] #-}-data RIPEMD160 = Digest !ByteString- deriving (Eq,Ord,Show) {-# INLINE digestSize #-} digestSize :: Int
Crypto/Hash/SHA1.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE ForeignFunctionInterface, CPP, MultiParamTypeClasses #-}+{-# LANGUAGE ForeignFunctionInterface #-} -- | -- Module : Crypto.Hash.SHA1@@ -11,7 +11,6 @@ -- module Crypto.Hash.SHA1 ( Ctx(..)- , SHA1 -- * Incremental hashing Functions , init -- :: Ctx@@ -37,40 +36,7 @@ import Data.Word import Crypto.Hash.Internal (unsafeDoIO) -#ifdef HAVE_CRYPTOAPI--import Control.Monad (liftM)-import Data.Serialize (Serialize(..))-import Data.Serialize.Get (getByteString)-import Data.Serialize.Put (putByteString)-import Data.Tagged (Tagged(..))-import qualified Crypto.Classes as C (Hash(..))--instance C.Hash Ctx SHA1 where- outputLength = Tagged (20 * 8)- blockLength = Tagged (64 * 8)- initialCtx = init- updateCtx = update- finalize ctx bs = Digest . finalize $ update ctx bs--instance Serialize SHA1 where- get = liftM Digest (getByteString digestSize)- put (Digest d) = putByteString d--#endif- newtype Ctx = Ctx ByteString--{-# DEPRECATED SHA1- ["Future cryptohash versions will not export crypto-api hash instances here."- ,"you can either :"- ," - carry using cryptoapi types and definitions by using the"- ," cryptohash-cryptoapi package and importing Crypto.Hash.CryptoAPI"- ," instead of Crypto.Hash.SHA1."- ," - use cryptohash's centralized API by importing Crypto.Hash"- ] #-}-data SHA1 = Digest !ByteString- deriving (Eq,Ord,Show) {-# INLINE digestSize #-} digestSize :: Int
Crypto/Hash/SHA224.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE ForeignFunctionInterface, CPP, MultiParamTypeClasses #-}+{-# LANGUAGE ForeignFunctionInterface #-} -- | -- Module : Crypto.Hash.SHA224@@ -11,7 +11,6 @@ -- module Crypto.Hash.SHA224 ( Ctx(..)- , SHA224 -- * Incremental hashing Functions , init -- :: Ctx@@ -37,40 +36,7 @@ import Data.Word import Crypto.Hash.Internal (unsafeDoIO) -#ifdef HAVE_CRYPTOAPI--import Control.Monad (liftM)-import Data.Serialize (Serialize(..))-import Data.Serialize.Get (getByteString)-import Data.Serialize.Put (putByteString)-import Data.Tagged (Tagged(..))-import qualified Crypto.Classes as C (Hash(..))--instance C.Hash Ctx SHA224 where- outputLength = Tagged (28 * 8)- blockLength = Tagged (64 * 8)- initialCtx = init- updateCtx = update- finalize ctx bs = Digest . finalize $ update ctx bs--instance Serialize SHA224 where- get = liftM Digest (getByteString digestSize)- put (Digest d) = putByteString d--#endif- newtype Ctx = Ctx ByteString--{-# DEPRECATED SHA224- ["Future cryptohash versions will not export crypto-api hash instances here."- ,"you can either :"- ," - carry using cryptoapi types and definitions by using the"- ," cryptohash-cryptoapi package and importing Crypto.Hash.CryptoAPI"- ," instead of Crypto.Hash.SHA224."- ," - use cryptohash's centralized API by importing Crypto.Hash"- ] #-}-data SHA224 = Digest !ByteString- deriving (Eq,Ord,Show) {-# INLINE digestSize #-} digestSize :: Int
Crypto/Hash/SHA256.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE ForeignFunctionInterface, CPP, MultiParamTypeClasses #-}+{-# LANGUAGE ForeignFunctionInterface #-} -- | -- Module : Crypto.Hash.SHA256@@ -11,7 +11,6 @@ -- module Crypto.Hash.SHA256 ( Ctx(..)- , SHA256 -- * Incremental hashing Functions , init -- :: Ctx@@ -37,40 +36,7 @@ import Data.Word import Crypto.Hash.Internal (unsafeDoIO) -#ifdef HAVE_CRYPTOAPI--import Control.Monad (liftM)-import Data.Serialize (Serialize(..))-import Data.Serialize.Get (getByteString)-import Data.Serialize.Put (putByteString)-import Data.Tagged (Tagged(..))-import qualified Crypto.Classes as C (Hash(..))--instance C.Hash Ctx SHA256 where- outputLength = Tagged (32 * 8)- blockLength = Tagged (64 * 8)- initialCtx = init- updateCtx = update- finalize ctx bs = Digest . finalize $ update ctx bs--instance Serialize SHA256 where- get = liftM Digest (getByteString digestSize)- put (Digest d) = putByteString d--#endif- newtype Ctx = Ctx ByteString--{-# DEPRECATED SHA256- ["Future cryptohash versions will not export crypto-api hash instances here."- ,"you can either :"- ," - carry using cryptoapi types and definitions by using the"- ," cryptohash-cryptoapi package and importing Crypto.Hash.CryptoAPI"- ," instead of Crypto.Hash.SHA256."- ," - use cryptohash's centralized API by importing Crypto.Hash"- ] #-}-data SHA256 = Digest !ByteString- deriving (Eq,Ord,Show) {-# INLINE digestSize #-} digestSize :: Int
Crypto/Hash/SHA3.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE ForeignFunctionInterface, CPP, MultiParamTypeClasses #-}+{-# LANGUAGE ForeignFunctionInterface #-} -- | -- Module : Crypto.Hash.SHA3@@ -11,7 +11,6 @@ -- module Crypto.Hash.SHA3 ( Ctx(..)- , SHA3 -- * Incremental hashing Functions , init -- :: Int -> Ctx@@ -36,40 +35,7 @@ import Data.Word import Crypto.Hash.Internal (unsafeDoIO) -#ifdef HAVE_CRYPTOAPI--import Control.Monad (liftM)-import Data.Serialize (Serialize(..))-import Data.Serialize.Get (getByteString)-import Data.Serialize.Put (putByteString)-import Data.Tagged (Tagged(..))-import qualified Crypto.Classes as C (Hash(..))--instance C.Hash Ctx SHA3 where- outputLength = Tagged (64 * 8)- blockLength = Tagged (64 * 8)- initialCtx = init (64 * 8)- updateCtx = update- finalize ctx bs = Digest . finalize $ update ctx bs--instance Serialize SHA3 where- get = liftM Digest (getByteString 64)- put (Digest d) = putByteString d--#endif- newtype Ctx = Ctx ByteString--{-# DEPRECATED SHA3- ["Future cryptohash versions will not export crypto-api hash instances here."- ,"you can either :"- ," - carry using cryptoapi types and definitions by using the"- ," cryptohash-cryptoapi package and importing Crypto.Hash.CryptoAPI"- ," instead of Crypto.Hash.SHA3."- ," - use cryptohash's centralized API by importing Crypto.Hash"- ] #-}-data SHA3 = Digest !ByteString- deriving (Eq,Ord,Show) {-# INLINE sizeCtx #-} sizeCtx :: Int
Crypto/Hash/SHA384.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE ForeignFunctionInterface, CPP, MultiParamTypeClasses #-}+{-# LANGUAGE ForeignFunctionInterface #-} -- | -- Module : Crypto.Hash.SHA384@@ -11,7 +11,6 @@ -- module Crypto.Hash.SHA384 ( Ctx(..)- , SHA384 -- * Incremental hashing Functions , init -- :: Ctx@@ -37,40 +36,7 @@ import Data.Word import Crypto.Hash.Internal (unsafeDoIO) -#ifdef HAVE_CRYPTOAPI--import Control.Monad (liftM)-import Data.Serialize (Serialize(..))-import Data.Serialize.Get (getByteString)-import Data.Serialize.Put (putByteString)-import Data.Tagged (Tagged(..))-import qualified Crypto.Classes as C (Hash(..))--instance C.Hash Ctx SHA384 where- outputLength = Tagged (48 * 8)- blockLength = Tagged (128 * 8)- initialCtx = init- updateCtx = update- finalize ctx bs = Digest . finalize $ update ctx bs--instance Serialize SHA384 where- get = liftM Digest (getByteString digestSize)- put (Digest d) = putByteString d--#endif- newtype Ctx = Ctx ByteString--{-# DEPRECATED SHA384- ["Future cryptohash versions will not export crypto-api hash instances here."- ,"you can either :"- ," - carry using cryptoapi types and definitions by using the"- ," cryptohash-cryptoapi package and importing Crypto.Hash.CryptoAPI"- ," instead of Crypto.Hash.SHA384."- ," - use cryptohash's centralized API by importing Crypto.Hash"- ] #-}-data SHA384 = Digest !ByteString- deriving (Eq,Ord,Show) {-# INLINE digestSize #-} digestSize :: Int
Crypto/Hash/SHA512.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE ForeignFunctionInterface, CPP, MultiParamTypeClasses #-}+{-# LANGUAGE ForeignFunctionInterface #-} -- | -- Module : Crypto.Hash.SHA512@@ -11,7 +11,6 @@ -- module Crypto.Hash.SHA512 ( Ctx(..)- , SHA512 -- * Incremental hashing Functions , init -- :: Ctx@@ -38,40 +37,7 @@ import Data.Word import Crypto.Hash.Internal (unsafeDoIO) -#ifdef HAVE_CRYPTOAPI--import Control.Monad (liftM)-import Data.Serialize (Serialize(..))-import Data.Serialize.Get (getByteString)-import Data.Serialize.Put (putByteString)-import Data.Tagged (Tagged(..))-import qualified Crypto.Classes as C (Hash(..))--instance C.Hash Ctx SHA512 where- outputLength = Tagged (64 * 8)- blockLength = Tagged (128 * 8)- initialCtx = init- updateCtx = update- finalize ctx bs = Digest . finalize $ update ctx bs--instance Serialize SHA512 where- get = liftM Digest (getByteString digestSize)- put (Digest d) = putByteString d--#endif- newtype Ctx = Ctx ByteString--{-# DEPRECATED SHA512- ["Future cryptohash versions will not export crypto-api hash instances here."- ,"you can either :"- ," - carry using cryptoapi types and definitions by using the"- ," cryptohash-cryptoapi package and importing Crypto.Hash.CryptoAPI"- ," instead of Crypto.Hash.SHA512."- ," - use cryptohash's centralized API by importing Crypto.Hash"- ] #-}-data SHA512 = Digest !ByteString- deriving (Eq,Ord,Show) {-# INLINE digestSize #-} digestSize :: Int
Crypto/Hash/Skein256.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE ForeignFunctionInterface, CPP, MultiParamTypeClasses #-}+{-# LANGUAGE ForeignFunctionInterface #-} -- | -- Module : Crypto.Hash.Skein256@@ -11,7 +11,6 @@ -- module Crypto.Hash.Skein256 ( Ctx(..)- , Skein256 -- * Incremental hashing Functions , init -- :: Int -> Ctx@@ -36,40 +35,7 @@ import Data.Word import Crypto.Hash.Internal (unsafeDoIO) -#ifdef HAVE_CRYPTOAPI--import Control.Monad (liftM)-import Data.Serialize (Serialize(..))-import Data.Serialize.Get (getByteString)-import Data.Serialize.Put (putByteString)-import Data.Tagged (Tagged(..))-import qualified Crypto.Classes as C (Hash(..))--instance C.Hash Ctx Skein256 where- outputLength = Tagged (32 * 8)- blockLength = Tagged (32 * 8)- initialCtx = init (32 * 8)- updateCtx = update- finalize ctx bs = Digest . finalize $ update ctx bs--instance Serialize Skein256 where- get = liftM Digest (getByteString 32)- put (Digest d) = putByteString d--#endif- newtype Ctx = Ctx ByteString--{-# DEPRECATED Skein256- ["Future cryptohash versions will not export crypto-api hash instances here."- ,"you can either :"- ," - carry using cryptoapi types and definitions by using the"- ," cryptohash-cryptoapi package and importing Crypto.Hash.CryptoAPI"- ," instead of Crypto.Hash.Skein256."- ," - use cryptohash's centralized API by importing Crypto.Hash"- ] #-}-data Skein256 = Digest !ByteString- deriving (Eq,Ord,Show) {-# INLINE sizeCtx #-} sizeCtx :: Int
Crypto/Hash/Skein512.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE ForeignFunctionInterface, CPP, MultiParamTypeClasses #-}+{-# LANGUAGE ForeignFunctionInterface #-} -- | -- Module : Crypto.Hash.Skein512@@ -11,7 +11,6 @@ -- module Crypto.Hash.Skein512 ( Ctx(..)- , Skein512 -- * Incremental hashing Functions , init -- :: Int -> Ctx@@ -36,40 +35,7 @@ import Data.Word import Crypto.Hash.Internal (unsafeDoIO) -#ifdef HAVE_CRYPTOAPI--import Control.Monad (liftM)-import Data.Serialize (Serialize(..))-import Data.Serialize.Get (getByteString)-import Data.Serialize.Put (putByteString)-import Data.Tagged (Tagged(..))-import qualified Crypto.Classes as C (Hash(..))--instance C.Hash Ctx Skein512 where- outputLength = Tagged (64 * 8)- blockLength = Tagged (64 * 8)- initialCtx = init (64 * 8)- updateCtx = update- finalize ctx bs = Digest . finalize $ update ctx bs--instance Serialize Skein512 where- get = liftM Digest (getByteString 64)- put (Digest d) = putByteString d--#endif- newtype Ctx = Ctx ByteString--{-# DEPRECATED Skein512- ["Future cryptohash versions will not export crypto-api hash instances here."- ,"you can either :"- ," - carry using cryptoapi types and definitions by using the"- ," cryptohash-cryptoapi package and importing Crypto.Hash.CryptoAPI"- ," instead of Crypto.Hash.Skein512."- ," - use cryptohash's centralized API by importing Crypto.Hash"- ] #-}-data Skein512 = Digest !ByteString- deriving (Eq,Ord,Show) {-# INLINE sizeCtx #-} sizeCtx :: Int
Crypto/Hash/Tiger.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE ForeignFunctionInterface, CPP, MultiParamTypeClasses #-}+{-# LANGUAGE ForeignFunctionInterface #-} -- | -- Module : Crypto.Hash.Tiger@@ -11,7 +11,6 @@ -- module Crypto.Hash.Tiger ( Ctx(..)- , Tiger -- * Incremental hashing Functions , init -- :: Ctx@@ -37,40 +36,7 @@ import Data.Word import Crypto.Hash.Internal (unsafeDoIO) -#ifdef HAVE_CRYPTOAPI--import Control.Monad (liftM)-import Data.Serialize (Serialize(..))-import Data.Serialize.Get (getByteString)-import Data.Serialize.Put (putByteString)-import Data.Tagged (Tagged(..))-import qualified Crypto.Classes as C (Hash(..))--instance C.Hash Ctx Tiger where- outputLength = Tagged (24 * 8)- blockLength = Tagged (64 * 8)- initialCtx = init- updateCtx = update- finalize ctx bs = Digest . finalize $ update ctx bs--instance Serialize Tiger where- get = liftM Digest (getByteString digestSize)- put (Digest d) = putByteString d--#endif- newtype Ctx = Ctx ByteString--{-# DEPRECATED Tiger- ["Future cryptohash versions will not export crypto-api hash instances here."- ,"you can either :"- ," - carry using cryptoapi types and definitions by using the"- ," cryptohash-cryptoapi package and importing Crypto.Hash.CryptoAPI"- ," instead of Crypto.Hash.Tiger."- ," - use cryptohash's centralized API by importing Crypto.Hash"- ] #-}-data Tiger = Digest !ByteString- deriving (Eq,Ord,Show) {-# INLINE digestSize #-} digestSize :: Int
Crypto/Hash/Types.hs view
@@ -62,6 +62,7 @@ toBytes (Digest bs) = bs -- | return the binary bytestring. deprecated use toBytes.+{-# DEPRECATED digestToByteString "use toBytes from byteable:Data.Byteable" #-} digestToByteString :: Digest a -> ByteString digestToByteString = toBytes
Crypto/Hash/Whirlpool.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE ForeignFunctionInterface, CPP, MultiParamTypeClasses #-}+{-# LANGUAGE ForeignFunctionInterface #-} -- | -- Module : Crypto.Hash.Whirlpool@@ -11,7 +11,6 @@ -- module Crypto.Hash.Whirlpool ( Ctx(..)- , Whirlpool -- * Incremental hashing Functions , init -- :: Ctx@@ -37,40 +36,7 @@ import Data.Word import Crypto.Hash.Internal (unsafeDoIO) -#ifdef HAVE_CRYPTOAPI--import Control.Monad (liftM)-import Data.Serialize (Serialize(..))-import Data.Serialize.Get (getByteString)-import Data.Serialize.Put (putByteString)-import Data.Tagged (Tagged(..))-import qualified Crypto.Classes as C (Hash(..))--instance C.Hash Ctx Whirlpool where- outputLength = Tagged (64 * 8)- blockLength = Tagged (64 * 8)- initialCtx = init- updateCtx = update- finalize ctx bs = Digest . finalize $ update ctx bs--instance Serialize Whirlpool where- get = liftM Digest (getByteString digestSize)- put (Digest d) = putByteString d--#endif- newtype Ctx = Ctx ByteString--{-# DEPRECATED Whirlpool- ["Future cryptohash versions will not export crypto-api hash instances here."- ,"you can either :"- ," - carry using cryptoapi types and definitions by using the"- ," cryptohash-cryptoapi package and importing Crypto.Hash.CryptoAPI"- ," instead of Crypto.Hash.Whirlpool."- ," - use cryptohash's centralized API by importing Crypto.Hash"- ] #-}-data Whirlpool = Digest !ByteString- deriving (Eq,Ord,Show) {-# INLINE digestSize #-} digestSize :: Int
cryptohash.cabal view
@@ -1,5 +1,5 @@ Name: cryptohash-Version: 0.9.1+Version: 0.10.0 Description: A collection of crypto hashes, with a practical incremental and one-pass, pure APIs, with performance close to the fastest implementations available in others languages.@@ -46,15 +46,8 @@ cbits/skein.h cbits/skein256.h cbits/skein512.h cbits/tiger.h cbits/whirlpool.h -Flag cryptoapi- Description: Defines crypto-api instances- Default: True- Library Build-Depends: base >= 4 && < 6, bytestring, byteable, ghc-prim- if flag(cryptoapi)- Build-depends: crypto-api >= 0.5, tagged >= 0.1, cereal >= 0.2- cpp-options: -DHAVE_CRYPTOAPI if impl(ghc >= 7.2.1) Extensions: Trustworthy Extensions: ForeignFunctionInterface@@ -119,7 +112,7 @@ Main-Is: BenchAPI.hs hs-source-dirs: Bench type: exitcode-stdio-1.0- Build-depends: base >= 4, bytestring, criterion, cryptohash, crypto-api+ Build-depends: base >= 4, bytestring, criterion, cryptohash, byteable source-repository head type: git