-- | pure hash interface, supported hash algorithms:
--
-- * SHA1
--
-- * SHA224/SHA256
--
-- * SHA384/SHA512
--
-- * MD5
--
-- * Whirlpool
--
-- NOTE: performance is just about 1 \/ 5 - 1 \/ 15 of C/ASM implementations.
--
module Crypto.Hash (
    HashAlgorithm(..)
  , SHA1
  , SHA224    
  , SHA256
  , SHA384
  , SHA512
  , MD5
  , Whirlpool
  , hash
  , hashLazy
  ) where

import qualified Data.ByteString.Lazy as LBS
import Data.ByteString (ByteString)

import Crypto.Hash.ADT

import Crypto.Hash.SHA1
import Crypto.Hash.SHA256
import Crypto.Hash.SHA512
import Crypto.Hash.MD5
import Crypto.Hash.Whirlpool

-- | Hash strict byte string
hash :: (HashAlgorithm a) => ByteString -> a
hash :: forall a. HashAlgorithm a => ByteString -> a
hash = forall a. HashAlgorithm a => Context a -> a
hashFinal forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. HashAlgorithm a => Context a -> ByteString -> Context a
hashUpdate forall a. HashAlgorithm a => Context a
hashInit

-- | Hash lazy byte string
hashLazy :: (HashAlgorithm a) => LBS.ByteString -> a
hashLazy :: forall a. HashAlgorithm a => ByteString -> a
hashLazy = forall a. HashAlgorithm a => Context a -> a
hashFinal forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. (a -> ByteString -> a) -> a -> ByteString -> a
LBS.foldlChunks forall a. HashAlgorithm a => Context a -> ByteString -> Context a
hashUpdate forall a. HashAlgorithm a => Context a
hashInit