HORIZON HASKELLDocslts/ghc-10.0.x8fef28d2026-11-02Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8fef28d · 2026-11-02

Modulecryptohash-0.11.9Haskell98

Crypto.Hash

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)
Contents
  1. Types
  2. Functions
  3. hash algorithms
  4. MAC algorithms
Synopsis

Types

classclass HashAlgorithm a where

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

Methods

Instances21HashAlgorithm, …
newtypenewtype Context a

Represent a context for a given hash algorithm.

Instances1Byteable
newtypenewtype Digest a

Represent a digest for a given hash algorithm.

Instances4Eq, Ord, Show, Byteable
  • Eq (Digest a)Defined in cryptohash-0.11.9 · Crypto.Hash.Types
  • Ord (Digest a)Defined in cryptohash-0.11.9 · Crypto.Hash.Types
  • Show (Digest a)Defined in cryptohash-0.11.9 · Crypto.Hash.Types
  • Byteable (Digest a)Defined in cryptohash-0.11.9 · Crypto.Hash.Types

Functions

hash algorithms

datadata MD2

MD2 cryptographic hash algorithm

Instances8Data, Show, HashAlgorithmASN1, HashAlgorithm, HashBlockSize, HashDigestSize, …
datadata MD4

MD4 cryptographic hash algorithm

Instances7Data, Show, HashAlgorithm, HashBlockSize, HashDigestSize, HashInternalContextSize, …
datadata MD5

MD5 cryptographic hash algorithm

Instances9Data, Show, HashAlgorithmPrefix, HashAlgorithmASN1, HashAlgorithm, HashBlockSize, …
datadata SHA1

SHA1 cryptographic hash algorithm

Instances9Data, Show, HashAlgorithmPrefix, HashAlgorithmASN1, HashAlgorithm, HashBlockSize, …
datadata SHA224

SHA224 cryptographic hash algorithm

Instances9Data, Show, HashAlgorithmPrefix, HashAlgorithmASN1, HashAlgorithm, HashBlockSize, …
datadata SHA256

SHA256 cryptographic hash algorithm

Instances9Data, Show, HashAlgorithmPrefix, HashAlgorithmASN1, HashAlgorithm, HashBlockSize, …
datadata SHA384

SHA384 cryptographic hash algorithm

Instances9Data, Show, HashAlgorithmPrefix, HashAlgorithmASN1, HashAlgorithm, HashBlockSize, …
datadata SHA512

SHA512 cryptographic hash algorithm

Instances9Data, Show, HashAlgorithmPrefix, HashAlgorithmASN1, HashAlgorithm, HashBlockSize, …
datadata RIPEMD160

RIPEMD160 cryptographic hash algorithm

Instances8Data, Show, HashAlgorithmASN1, HashAlgorithm, HashBlockSize, HashDigestSize, …
datadata Tiger

Tiger cryptographic hash algorithm

Instances7Data, Show, HashAlgorithm, HashBlockSize, HashDigestSize, HashInternalContextSize, …
datadata SHA3_224

SHA3 (224 bits) cryptographic hash algorithm

Instances7Data, Show, HashAlgorithm, HashBlockSize, HashDigestSize, HashInternalContextSize, …
datadata SHA3_256

SHA3 (256 bits) cryptographic hash algorithm

Instances7Data, Show, HashAlgorithm, HashBlockSize, HashDigestSize, HashInternalContextSize, …
datadata SHA3_384

SHA3 (384 bits) cryptographic hash algorithm

Instances7Data, Show, HashAlgorithm, HashBlockSize, HashDigestSize, HashInternalContextSize, …
datadata SHA3_512

SHA3 (512 bits) cryptographic hash algorithm

Instances7Data, Show, HashAlgorithm, HashBlockSize, HashDigestSize, HashInternalContextSize, …
datadata Skein256_224

Skein256 (224 bits) cryptographic hash algorithm

Instances7Data, Show, HashAlgorithm, HashBlockSize, HashDigestSize, HashInternalContextSize, …
datadata Skein256_256

Skein256 (256 bits) cryptographic hash algorithm

Instances7Data, Show, HashAlgorithm, HashBlockSize, HashDigestSize, HashInternalContextSize, …
datadata Skein512_224

Skein512 (224 bits) cryptographic hash algorithm

Instances7Data, Show, HashAlgorithm, HashBlockSize, HashDigestSize, HashInternalContextSize, …
datadata Skein512_256

Skein512 (256 bits) cryptographic hash algorithm

Instances7Data, Show, HashAlgorithm, HashBlockSize, HashDigestSize, HashInternalContextSize, …
datadata Skein512_384

Skein512 (384 bits) cryptographic hash algorithm

Instances7Data, Show, HashAlgorithm, HashBlockSize, HashDigestSize, HashInternalContextSize, …
datadata Skein512_512

Skein512 (512 bits) cryptographic hash algorithm

Instances7Data, Show, HashAlgorithm, HashBlockSize, HashDigestSize, HashInternalContextSize, …
datadata Whirlpool

Whirlpool cryptographic hash algorithm

Instances7Data, Show, HashAlgorithm, HashBlockSize, HashDigestSize, HashInternalContextSize, …

MAC algorithms

newtypenewtype HMAC a

Represent an HMAC that is a phantom type with the hash used to produce the mac.

The Eq instance is constant time.

Constructors

Instances2Eq, Byteable
  • Eq (HMAC a)Defined in cryptohash-0.11.9 · Crypto.Hash
  • Byteable (HMAC a)Defined in cryptohash-0.11.9 · Crypto.Hash