hash package:cryptohash

Hash a strict bytestring into a digest.
hash a strict bytestring into a digest bytestring
hash a strict bytestring into a digest bytestring
Generalized cryptographic hash interface, that you can use with cryptographic hash algorithm that belong to the HashAlgorithm type class.
import Crypto.Hash

sha1 :: ByteString -> Digest SHA1
sha1 = hash

hexSha3_512 :: ByteString -> String
hexSha3_512 bs = show (hash bs :: Digest SHA3_512)
Block size in bytes the hash algorithm operates on
Finalize a context and return a digest.
Initialize a new context for this hash algorithm
Initialize a new context for a specified hash algorithm
run hashUpdates on one single bytestring and return the updated context.
Update the context with a list of strict bytestring, and return a new context with the updates.
Hash a lazy bytestring into a digest.
hash a lazy bytestring into a digest bytestring
hash a lazy bytestring into a digest bytestring
Class representing hashing algorithms. The hash algorithm is built over 3 primitives:
  • init : create a new hashing context
  • updates : update the hashing context with some strict bytestrings and return the new context
  • finalize : finalize the context into a digest
Alias to a single pass hash function that operate on a strict bytestring
Alias to a single pass hash function that operate on a lazy bytestring
collection of crypto hashes, fast, pure and practical DEPRECATED: this library is still fully functional, but please use cryptonite for new projects and convert old one to use cryptonite. This is where things are at nowadays. A collection of crypto hashes, with a practical incremental and one-pass, pure APIs, with performance close to the fastest implementations available in other languages. The implementations are made in C with a haskell FFI wrapper that hide the C implementation. Simple examples using the unified API:
import Crypto.Hash

sha1 :: ByteString -> Digest SHA1
sha1 = hash

hexSha3_512 :: ByteString -> String
hexSha3_512 bs = show (hash bs :: Digest SHA3_512)
Simple examples using the module API:
import qualified Crypto.Hash.SHA1 as SHA1

main = putStrLn $ show $ SHA1.hash (Data.ByteString.pack [0..255])
import qualified Crypto.Hash.SHA3 as SHA3

main = putStrLn $ show $ digest
where digest = SHA3.finalize ctx
ctx    = foldl' SHA3.update iCtx (map Data.ByteString.pack [ [1,2,3], [4,5,6] ]
iCtx   = SHA3.init 224