Crypto.Hash

cryptohash-0.11.0: collection of crypto hashes, fast, pure and practical

License | BSD-style
Maintainer | Vincent Hanquez <vincent@snarc.org>
Stability | experimental
Portability | unknown
Safe Haskell | Trustworthy
Language | Haskell98

Crypto.Hash

Contents

- Types
- Functions
- hash algorithms
- MAC algorithms

Description

Crypto hash main module

Synopsis

- class HashAlgorithm a where
  - hashBlockSize :: Context a -> Int
  - hashInit :: Context a
  - hashUpdates :: Context a -> [ByteString] -> Context a
  - hashFinalize :: Context a -> Digest a
  - digestFromByteString :: ByteString -> Maybe (Digest a)
- type HashFunctionBS a = ByteString -> Digest a
- type HashFunctionLBS a = ByteString -> Digest a
- data Context a
- data Digest a
- digestToByteString :: Digest a -> ByteString
- digestToHexByteString :: Digest a -> ByteString
- hash :: HashAlgorithm a => ByteString -> Digest a
- hashlazy :: HashAlgorithm a => ByteString -> Digest a
- hashUpdate :: HashAlgorithm a => Context a -> ByteString -> Context a
- hashInitAlg :: HashAlgorithm alg => alg -> Context alg
- data MD2 = MD2
- data MD4 = MD4
- data MD5 = MD5
- data SHA1 = SHA1
- data SHA224 = SHA224
- data SHA256 = SHA256
- data SHA384 = SHA384
- data SHA512 = SHA512
- data RIPEMD160 = RIPEMD160
- data Tiger = Tiger
- data SHA3_224 = SHA3_224
- data SHA3_256 = SHA3_256
- data SHA3_384 = SHA3_384
- data SHA3_512 = SHA3_512
- data Skein256_224 = Skein256_224
- data Skein256_256 = Skein256_256
- data Skein512_224 = Skein512_224
- data Skein512_256 = Skein512_256
- data Skein512_384 = Skein512_384
- data Skein512_512 = Skein512_512
- data Whirlpool = Whirlpool
- newtype HMAC a = HMAC {
  - hmacGetDigest :: Digest a
  }
- hmac :: HashAlgorithm a => ByteString -> ByteString -> HMAC a
- hmacAlg :: HashAlgorithm a => a -> ByteString -> ByteString -> HMAC a

# Types

class HashAlgorithm a where #

Class representing hashing algorithms.

The hash algorithm is built over 3 primitives:

init : create a new context updates : update the context with some strict bytestrings finalize : finalize the context into a digest

Methods

hashBlockSize :: Context a -> Int #

Block size in bytes the hash algorithm operates on

hashInit :: Context a #

Initialize a new context for this hash algorithm

hashUpdates :: Context a -> [ByteString] -> Context a #

Update the context with a list of strict bytestring, and return a new context with the updates.

hashFinalize :: Context a -> Digest a #

Finalize a context and return a digest.

digestFromByteString :: ByteString -> Maybe (Digest a) #

Try to convert a binary digest bytestring to a digest.

Instances

HashAlgorithm Skein512_512 # |
Instance details Defined in Crypto.Hash Methods hashBlockSize :: Context Skein512_512 -> Int # hashInit :: Context Skein512_512 # hashUpdates :: Context Skein512_512 -> [ByteString] -> Context Skein512_512 # hashFinalize :: Context Skein512_512 -> Digest Skein512_512 # digestFromByteString :: ByteString -> Maybe (Digest Skein512_512) #
HashAlgorithm Skein512_384 # |
Instance details Defined in Crypto.Hash Methods hashBlockSize :: Context Skein512_384 -> Int # hashInit :: Context Skein512_384 # hashUpdates :: Context Skein512_384 -> [ByteString] -> Context Skein512_384 # hashFinalize :: Context Skein512_384 -> Digest Skein512_384 # digestFromByteString :: ByteString -> Maybe (Digest Skein512_384) #
HashAlgorithm Skein512_256 # |
Instance details Defined in Crypto.Hash Methods hashBlockSize :: Context Skein512_256 -> Int # hashInit :: Context Skein512_256 # hashUpdates :: Context Skein512_256 -> [ByteString] -> Context Skein512_256 # hashFinalize :: Context Skein512_256 -> Digest Skein512_256 # digestFromByteString :: ByteString -> Maybe (Digest Skein512_256) #
HashAlgorithm Skein512_224 # |
Instance details Defined in Crypto.Hash Methods hashBlockSize :: Context Skein512_224 -> Int # hashInit :: Context Skein512_224 # hashUpdates :: Context Skein512_224 -> [ByteString] -> Context Skein512_224 # hashFinalize :: Context Skein512_224 -> Digest Skein512_224 # digestFromByteString :: ByteString -> Maybe (Digest Skein512_224) #
HashAlgorithm Skein256_256 # |
Instance details Defined in Crypto.Hash Methods hashBlockSize :: Context Skein256_256 -> Int # hashInit :: Context Skein256_256 # hashUpdates :: Context Skein256_256 -> [ByteString] -> Context Skein256_256 # hashFinalize :: Context Skein256_256 -> Digest Skein256_256 # digestFromByteString :: ByteString -> Maybe (Digest Skein256_256) #
HashAlgorithm Skein256_224 # |
Instance details Defined in Crypto.Hash Methods hashBlockSize :: Context Skein256_224 -> Int # hashInit :: Context Skein256_224 # hashUpdates :: Context Skein256_224 -> [ByteString] -> Context Skein256_224 # hashFinalize :: Context Skein256_224 -> Digest Skein256_224 # digestFromByteString :: ByteString -> Maybe (Digest Skein256_224) #
HashAlgorithm SHA3_512 # |
Instance details Defined in Crypto.Hash Methods hashBlockSize :: Context SHA3_512 -> Int # hashInit :: Context SHA3_512 # hashUpdates :: Context SHA3_512 -> [ByteString] -> Context SHA3_512 # hashFinalize :: Context SHA3_512 -> Digest SHA3_512 # digestFromByteString :: ByteString -> Maybe (Digest SHA3_512) #
HashAlgorithm SHA3_384 # |
Instance details Defined in Crypto.Hash Methods hashBlockSize :: Context SHA3_384 -> Int # hashInit :: Context SHA3_384 # hashUpdates :: Context SHA3_384 -> [ByteString] -> Context SHA3_384 # hashFinalize :: Context SHA3_384 -> Digest SHA3_384 # digestFromByteString :: ByteString -> Maybe (Digest SHA3_384) #
HashAlgorithm SHA3_256 # |
Instance details Defined in Crypto.Hash Methods hashBlockSize :: Context SHA3_256 -> Int # hashInit :: Context SHA3_256 # hashUpdates :: Context SHA3_256 -> [ByteString] -> Context SHA3_256 # hashFinalize :: Context SHA3_256 -> Digest SHA3_256 # digestFromByteString :: ByteString -> Maybe (Digest SHA3_256) #
HashAlgorithm SHA3_224 # |
Instance details Defined in Crypto.Hash Methods hashBlockSize :: Context SHA3_224 -> Int # hashInit :: Context SHA3_224 # hashUpdates :: Context SHA3_224 -> [ByteString] -> Context SHA3_224 # hashFinalize :: Context SHA3_224 -> Digest SHA3_224 # digestFromByteString :: ByteString -> Maybe (Digest SHA3_224) #
HashAlgorithm Tiger # |
Instance details Defined in Crypto.Hash Methods hashBlockSize :: Context Tiger -> Int # hashInit :: Context Tiger # hashUpdates :: Context Tiger -> [ByteString] -> Context Tiger # hashFinalize :: Context Tiger -> Digest Tiger # digestFromByteString :: ByteString -> Maybe (Digest Tiger) #
HashAlgorithm Whirlpool # |
Instance details Defined in Crypto.Hash Methods hashBlockSize :: Context Whirlpool -> Int # hashInit :: Context Whirlpool # hashUpdates :: Context Whirlpool -> [ByteString] -> Context Whirlpool # hashFinalize :: Context Whirlpool -> Digest Whirlpool # digestFromByteString :: ByteString -> Maybe (Digest Whirlpool) #
HashAlgorithm RIPEMD160 # |
Instance details Defined in Crypto.Hash Methods hashBlockSize :: Context RIPEMD160 -> Int # hashInit :: Context RIPEMD160 # hashUpdates :: Context RIPEMD160 -> [ByteString] -> Context RIPEMD160 # hashFinalize :: Context RIPEMD160 -> Digest RIPEMD160 # digestFromByteString :: ByteString -> Maybe (Digest RIPEMD160) #
HashAlgorithm SHA512 # |
Instance details Defined in Crypto.Hash Methods hashBlockSize :: Context SHA512 -> Int # hashInit :: Context SHA512 # hashUpdates :: Context SHA512 -> [ByteString] -> Context SHA512 # hashFinalize :: Context SHA512 -> Digest SHA512 # digestFromByteString :: ByteString -> Maybe (Digest SHA512) #
HashAlgorithm SHA384 # |
Instance details Defined in Crypto.Hash Methods hashBlockSize :: Context SHA384 -> Int # hashInit :: Context SHA384 # hashUpdates :: Context SHA384 -> [ByteString] -> Context SHA384 # hashFinalize :: Context SHA384 -> Digest SHA384 # digestFromByteString :: ByteString -> Maybe (Digest SHA384) #
HashAlgorithm SHA256 # |
Instance details Defined in Crypto.Hash Methods hashBlockSize :: Context SHA256 -> Int # hashInit :: Context SHA256 # hashUpdates :: Context SHA256 -> [ByteString] -> Context SHA256 # hashFinalize :: Context SHA256 -> Digest SHA256 # digestFromByteString :: ByteString -> Maybe (Digest SHA256) #
HashAlgorithm SHA224 # |
Instance details Defined in Crypto.Hash Methods hashBlockSize :: Context SHA224 -> Int # hashInit :: Context SHA224 # hashUpdates :: Context SHA224 -> [ByteString] -> Context SHA224 # hashFinalize :: Context SHA224 -> Digest SHA224 # digestFromByteString :: ByteString -> Maybe (Digest SHA224) #
HashAlgorithm SHA1 # |
Instance details Defined in Crypto.Hash Methods hashBlockSize :: Context SHA1 -> Int # hashInit :: Context SHA1 # hashUpdates :: Context SHA1 -> [ByteString] -> Context SHA1 # hashFinalize :: Context SHA1 -> Digest SHA1 # digestFromByteString :: ByteString -> Maybe (Digest SHA1) #
HashAlgorithm MD5 # |
Instance details Defined in Crypto.Hash Methods hashBlockSize :: Context MD5 -> Int # hashInit :: Context MD5 # hashUpdates :: Context MD5 -> [ByteString] -> Context MD5 # hashFinalize :: Context MD5 -> Digest MD5 # digestFromByteString :: ByteString -> Maybe (Digest MD5) #
HashAlgorithm MD4 # |
Instance details Defined in Crypto.Hash Methods hashBlockSize :: Context MD4 -> Int # hashInit :: Context MD4 # hashUpdates :: Context MD4 -> [ByteString] -> Context MD4 # hashFinalize :: Context MD4 -> Digest MD4 # digestFromByteString :: ByteString -> Maybe (Digest MD4) #
HashAlgorithm MD2 # |
Instance details Defined in Crypto.Hash Methods hashBlockSize :: Context MD2 -> Int # hashInit :: Context MD2 # hashUpdates :: Context MD2 -> [ByteString] -> Context MD2 # hashFinalize :: Context MD2 -> Digest MD2 # digestFromByteString :: ByteString -> Maybe (Digest MD2) #

type HashFunctionBS a = ByteString -> Digest a #

Alias to a single pass hash function that operate on a strict bytestring

type HashFunctionLBS a = ByteString -> Digest a #

Alias to a single pass hash function that operate on a lazy bytestring

data Context a #

Represent a context for a given hash algorithm.

Instances

Byteable (Context a) # |
Instance details Defined in Crypto.Hash.Types Methods toBytes :: Context a -> ByteString # byteableLength :: Context a -> Int # withBytePtr :: Context a -> (Ptr Word8 -> IO b) -> IO b #

data Digest a #

Represent a digest for a given hash algorithm.

Instances

Eq (Digest a) # |
Instance details Defined in Crypto.Hash.Types Methods (==) :: Digest a -> Digest a -> Bool # (/=) :: Digest a -> Digest a -> Bool #
Ord (Digest a) # |
Instance details Defined in Crypto.Hash.Types Methods compare :: Digest a -> Digest a -> Ordering # (<) :: Digest a -> Digest a -> Bool # (<=) :: Digest a -> Digest a -> Bool # (>) :: Digest a -> Digest a -> Bool # (>=) :: Digest a -> Digest a -> Bool # max :: Digest a -> Digest a -> Digest a # min :: Digest a -> Digest a -> Digest a #
Show (Digest a) # |
Instance details Defined in Crypto.Hash.Types Methods showsPrec :: Int -> Digest a -> ShowS # show :: Digest a -> String # showList :: [Digest a] -> ShowS #
Byteable (Digest a) # |
Instance details Defined in Crypto.Hash.Types Methods toBytes :: Digest a -> ByteString # byteableLength :: Digest a -> Int # withBytePtr :: Digest a -> (Ptr Word8 -> IO b) -> IO b #

# Functions

digestToByteString :: Digest a -> ByteString #

Deprecated: use toBytes from byteable:Data.Byteable

return the binary bytestring. deprecated use toBytes.

digestToHexByteString :: Digest a -> ByteString #

Return the hexadecimal (base16) bytestring of the digest

hash :: HashAlgorithm a => ByteString -> Digest a #

Hash a strict bytestring into a digest.

hashlazy :: HashAlgorithm a => ByteString -> Digest a #

Hash a lazy bytestring into a digest.

hashUpdate :: HashAlgorithm a => Context a -> ByteString -> Context a #

run hashUpdates on one single bytestring and return the updated context.

hashInitAlg :: HashAlgorithm alg => alg -> Context alg #

Initialize a new context for a specified hash algorithm

# hash algorithms

data MD2 #

MD2 cryptographic hash

Constructors

MD2 |

Instances

Show MD2 # |
Instance details Defined in Crypto.Hash Methods showsPrec :: Int -> MD2 -> ShowS # show :: MD2 -> String # showList :: [MD2] -> ShowS #
HashAlgorithm MD2 # |
Instance details Defined in Crypto.Hash Methods hashBlockSize :: Context MD2 -> Int # hashInit :: Context MD2 # hashUpdates :: Context MD2 -> [ByteString] -> Context MD2 # hashFinalize :: Context MD2 -> Digest MD2 # digestFromByteString :: ByteString -> Maybe (Digest MD2) #

data MD4 #

MD4 cryptographic hash

Constructors

MD4 |

Instances

Show MD4 # |
Instance details Defined in Crypto.Hash Methods showsPrec :: Int -> MD4 -> ShowS # show :: MD4 -> String # showList :: [MD4] -> ShowS #
HashAlgorithm MD4 # |
Instance details Defined in Crypto.Hash Methods hashBlockSize :: Context MD4 -> Int # hashInit :: Context MD4 # hashUpdates :: Context MD4 -> [ByteString] -> Context MD4 # hashFinalize :: Context MD4 -> Digest MD4 # digestFromByteString :: ByteString -> Maybe (Digest MD4) #

data MD5 #

MD5 cryptographic hash

Constructors

MD5 |

Instances

Show MD5 # |
Instance details Defined in Crypto.Hash Methods showsPrec :: Int -> MD5 -> ShowS # show :: MD5 -> String # showList :: [MD5] -> ShowS #
HashAlgorithm MD5 # |
Instance details Defined in Crypto.Hash Methods hashBlockSize :: Context MD5 -> Int # hashInit :: Context MD5 # hashUpdates :: Context MD5 -> [ByteString] -> Context MD5 # hashFinalize :: Context MD5 -> Digest MD5 # digestFromByteString :: ByteString -> Maybe (Digest MD5) #

data SHA1 #

SHA1 cryptographic hash

Constructors

SHA1 |

Instances

Show SHA1 # |
Instance details Defined in Crypto.Hash Methods showsPrec :: Int -> SHA1 -> ShowS # show :: SHA1 -> String # showList :: [SHA1] -> ShowS #
HashAlgorithm SHA1 # |
Instance details Defined in Crypto.Hash Methods hashBlockSize :: Context SHA1 -> Int # hashInit :: Context SHA1 # hashUpdates :: Context SHA1 -> [ByteString] -> Context SHA1 # hashFinalize :: Context SHA1 -> Digest SHA1 # digestFromByteString :: ByteString -> Maybe (Digest SHA1) #

data SHA224 #

SHA224 cryptographic hash

Constructors

SHA224 |

Instances

Show SHA224 # |
Instance details Defined in Crypto.Hash Methods showsPrec :: Int -> SHA224 -> ShowS # show :: SHA224 -> String # showList :: [SHA224] -> ShowS #
HashAlgorithm SHA224 # |
Instance details Defined in Crypto.Hash Methods hashBlockSize :: Context SHA224 -> Int # hashInit :: Context SHA224 # hashUpdates :: Context SHA224 -> [ByteString] -> Context SHA224 # hashFinalize :: Context SHA224 -> Digest SHA224 # digestFromByteString :: ByteString -> Maybe (Digest SHA224) #

data SHA256 #

SHA256 cryptographic hash

Constructors

SHA256 |

Instances

Show SHA256 # |
Instance details Defined in Crypto.Hash Methods showsPrec :: Int -> SHA256 -> ShowS # show :: SHA256 -> String # showList :: [SHA256] -> ShowS #
HashAlgorithm SHA256 # |
Instance details Defined in Crypto.Hash Methods hashBlockSize :: Context SHA256 -> Int # hashInit :: Context SHA256 # hashUpdates :: Context SHA256 -> [ByteString] -> Context SHA256 # hashFinalize :: Context SHA256 -> Digest SHA256 # digestFromByteString :: ByteString -> Maybe (Digest SHA256) #

data SHA384 #

SHA384 cryptographic hash

Constructors

SHA384 |

Instances

Show SHA384 # |
Instance details Defined in Crypto.Hash Methods showsPrec :: Int -> SHA384 -> ShowS # show :: SHA384 -> String # showList :: [SHA384] -> ShowS #
HashAlgorithm SHA384 # |
Instance details Defined in Crypto.Hash Methods hashBlockSize :: Context SHA384 -> Int # hashInit :: Context SHA384 # hashUpdates :: Context SHA384 -> [ByteString] -> Context SHA384 # hashFinalize :: Context SHA384 -> Digest SHA384 # digestFromByteString :: ByteString -> Maybe (Digest SHA384) #

data SHA512 #

SHA512 cryptographic hash

Constructors

SHA512 |

Instances

Show SHA512 # |
Instance details Defined in Crypto.Hash Methods showsPrec :: Int -> SHA512 -> ShowS # show :: SHA512 -> String # showList :: [SHA512] -> ShowS #
HashAlgorithm SHA512 # |
Instance details Defined in Crypto.Hash Methods hashBlockSize :: Context SHA512 -> Int # hashInit :: Context SHA512 # hashUpdates :: Context SHA512 -> [ByteString] -> Context SHA512 # hashFinalize :: Context SHA512 -> Digest SHA512 # digestFromByteString :: ByteString -> Maybe (Digest SHA512) #

data RIPEMD160 #

RIPEMD160 cryptographic hash

Constructors

RIPEMD160 |

Instances

Show RIPEMD160 # |
Instance details Defined in Crypto.Hash Methods showsPrec :: Int -> RIPEMD160 -> ShowS # show :: RIPEMD160 -> String # showList :: [RIPEMD160] -> ShowS #
HashAlgorithm RIPEMD160 # |
Instance details Defined in Crypto.Hash Methods hashBlockSize :: Context RIPEMD160 -> Int # hashInit :: Context RIPEMD160 # hashUpdates :: Context RIPEMD160 -> [ByteString] -> Context RIPEMD160 # hashFinalize :: Context RIPEMD160 -> Digest RIPEMD160 # digestFromByteString :: ByteString -> Maybe (Digest RIPEMD160) #

data Tiger #

Tiger cryptographic hash

Constructors

Tiger |

Instances

Show Tiger # |
Instance details Defined in Crypto.Hash Methods showsPrec :: Int -> Tiger -> ShowS # show :: Tiger -> String # showList :: [Tiger] -> ShowS #
HashAlgorithm Tiger # |
Instance details Defined in Crypto.Hash Methods hashBlockSize :: Context Tiger -> Int # hashInit :: Context Tiger # hashUpdates :: Context Tiger -> [ByteString] -> Context Tiger # hashFinalize :: Context Tiger -> Digest Tiger # digestFromByteString :: ByteString -> Maybe (Digest Tiger) #

data SHA3_224 #

SHA3 (224 bits version) cryptographic hash

Constructors

SHA3_224 |

Instances

Show SHA3_224 # |
Instance details Defined in Crypto.Hash Methods showsPrec :: Int -> SHA3_224 -> ShowS # show :: SHA3_224 -> String # showList :: [SHA3_224] -> ShowS #
HashAlgorithm SHA3_224 # |
Instance details Defined in Crypto.Hash Methods hashBlockSize :: Context SHA3_224 -> Int # hashInit :: Context SHA3_224 # hashUpdates :: Context SHA3_224 -> [ByteString] -> Context SHA3_224 # hashFinalize :: Context SHA3_224 -> Digest SHA3_224 # digestFromByteString :: ByteString -> Maybe (Digest SHA3_224) #

data SHA3_256 #

SHA3 (256 bits version) cryptographic hash

Constructors

SHA3_256 |

Instances

Show SHA3_256 # |
Instance details Defined in Crypto.Hash Methods showsPrec :: Int -> SHA3_256 -> ShowS # show :: SHA3_256 -> String # showList :: [SHA3_256] -> ShowS #
HashAlgorithm SHA3_256 # |
Instance details Defined in Crypto.Hash Methods hashBlockSize :: Context SHA3_256 -> Int # hashInit :: Context SHA3_256 # hashUpdates :: Context SHA3_256 -> [ByteString] -> Context SHA3_256 # hashFinalize :: Context SHA3_256 -> Digest SHA3_256 # digestFromByteString :: ByteString -> Maybe (Digest SHA3_256) #

data SHA3_384 #

SHA3 (384 bits version) cryptographic hash

Constructors

SHA3_384 |

Instances

Show SHA3_384 # |
Instance details Defined in Crypto.Hash Methods showsPrec :: Int -> SHA3_384 -> ShowS # show :: SHA3_384 -> String # showList :: [SHA3_384] -> ShowS #
HashAlgorithm SHA3_384 # |
Instance details Defined in Crypto.Hash Methods hashBlockSize :: Context SHA3_384 -> Int # hashInit :: Context SHA3_384 # hashUpdates :: Context SHA3_384 -> [ByteString] -> Context SHA3_384 # hashFinalize :: Context SHA3_384 -> Digest SHA3_384 # digestFromByteString :: ByteString -> Maybe (Digest SHA3_384) #

data SHA3_512 #

SHA3 (512 bits version) cryptographic hash

Constructors

SHA3_512 |

Instances

Show SHA3_512 # |
Instance details Defined in Crypto.Hash Methods showsPrec :: Int -> SHA3_512 -> ShowS # show :: SHA3_512 -> String # showList :: [SHA3_512] -> ShowS #
HashAlgorithm SHA3_512 # |
Instance details Defined in Crypto.Hash Methods hashBlockSize :: Context SHA3_512 -> Int # hashInit :: Context SHA3_512 # hashUpdates :: Context SHA3_512 -> [ByteString] -> Context SHA3_512 # hashFinalize :: Context SHA3_512 -> Digest SHA3_512 # digestFromByteString :: ByteString -> Maybe (Digest SHA3_512) #

data Skein256_224 #

Skein256 (224 bits version) cryptographic hash

Constructors

Skein256_224 |

Instances

Show Skein256_224 # |
Instance details Defined in Crypto.Hash Methods showsPrec :: Int -> Skein256_224 -> ShowS # show :: Skein256_224 -> String # showList :: [Skein256_224] -> ShowS #
HashAlgorithm Skein256_224 # |
Instance details Defined in Crypto.Hash Methods hashBlockSize :: Context Skein256_224 -> Int # hashInit :: Context Skein256_224 # hashUpdates :: Context Skein256_224 -> [ByteString] -> Context Skein256_224 # hashFinalize :: Context Skein256_224 -> Digest Skein256_224 # digestFromByteString :: ByteString -> Maybe (Digest Skein256_224) #

data Skein256_256 #

Skein256 (256 bits version) cryptographic hash

Constructors

Skein256_256 |

Instances

Show Skein256_256 # |
Instance details Defined in Crypto.Hash Methods showsPrec :: Int -> Skein256_256 -> ShowS # show :: Skein256_256 -> String # showList :: [Skein256_256] -> ShowS #
HashAlgorithm Skein256_256 # |
Instance details Defined in Crypto.Hash Methods hashBlockSize :: Context Skein256_256 -> Int # hashInit :: Context Skein256_256 # hashUpdates :: Context Skein256_256 -> [ByteString] -> Context Skein256_256 # hashFinalize :: Context Skein256_256 -> Digest Skein256_256 # digestFromByteString :: ByteString -> Maybe (Digest Skein256_256) #

data Skein512_224 #

Skein512 (224 bits version) cryptographic hash

Constructors

Skein512_224 |

Instances

Show Skein512_224 # |
Instance details Defined in Crypto.Hash Methods showsPrec :: Int -> Skein512_224 -> ShowS # show :: Skein512_224 -> String # showList :: [Skein512_224] -> ShowS #
HashAlgorithm Skein512_224 # |
Instance details Defined in Crypto.Hash Methods hashBlockSize :: Context Skein512_224 -> Int # hashInit :: Context Skein512_224 # hashUpdates :: Context Skein512_224 -> [ByteString] -> Context Skein512_224 # hashFinalize :: Context Skein512_224 -> Digest Skein512_224 # digestFromByteString :: ByteString -> Maybe (Digest Skein512_224) #

data Skein512_256 #

Skein512 (256 bits version) cryptographic hash

Constructors

Skein512_256 |

Instances

Show Skein512_256 # |
Instance details Defined in Crypto.Hash Methods showsPrec :: Int -> Skein512_256 -> ShowS # show :: Skein512_256 -> String # showList :: [Skein512_256] -> ShowS #
HashAlgorithm Skein512_256 # |
Instance details Defined in Crypto.Hash Methods hashBlockSize :: Context Skein512_256 -> Int # hashInit :: Context Skein512_256 # hashUpdates :: Context Skein512_256 -> [ByteString] -> Context Skein512_256 # hashFinalize :: Context Skein512_256 -> Digest Skein512_256 # digestFromByteString :: ByteString -> Maybe (Digest Skein512_256) #

data Skein512_384 #

Skein512 (384 bits version) cryptographic hash

Constructors

Skein512_384 |

Instances

Show Skein512_384 # |
Instance details Defined in Crypto.Hash Methods showsPrec :: Int -> Skein512_384 -> ShowS # show :: Skein512_384 -> String # showList :: [Skein512_384] -> ShowS #
HashAlgorithm Skein512_384 # |
Instance details Defined in Crypto.Hash Methods hashBlockSize :: Context Skein512_384 -> Int # hashInit :: Context Skein512_384 # hashUpdates :: Context Skein512_384 -> [ByteString] -> Context Skein512_384 # hashFinalize :: Context Skein512_384 -> Digest Skein512_384 # digestFromByteString :: ByteString -> Maybe (Digest Skein512_384) #

data Skein512_512 #

Skein512 (512 bits version) cryptographic hash

Constructors

Skein512_512 |

Instances

Show Skein512_512 # |
Instance details Defined in Crypto.Hash Methods showsPrec :: Int -> Skein512_512 -> ShowS # show :: Skein512_512 -> String # showList :: [Skein512_512] -> ShowS #
HashAlgorithm Skein512_512 # |
Instance details Defined in Crypto.Hash Methods hashBlockSize :: Context Skein512_512 -> Int # hashInit :: Context Skein512_512 # hashUpdates :: Context Skein512_512 -> [ByteString] -> Context Skein512_512 # hashFinalize :: Context Skein512_512 -> Digest Skein512_512 # digestFromByteString :: ByteString -> Maybe (Digest Skein512_512) #

data Whirlpool #

Whirlpool cryptographic hash

Constructors

Whirlpool |

Instances

Show Whirlpool # |
Instance details Defined in Crypto.Hash Methods showsPrec :: Int -> Whirlpool -> ShowS # show :: Whirlpool -> String # showList :: [Whirlpool] -> ShowS #
HashAlgorithm Whirlpool # |
Instance details Defined in Crypto.Hash Methods hashBlockSize :: Context Whirlpool -> Int # hashInit :: Context Whirlpool # hashUpdates :: Context Whirlpool -> [ByteString] -> Context Whirlpool # hashFinalize :: Context Whirlpool -> Digest Whirlpool # digestFromByteString :: ByteString -> Maybe (Digest Whirlpool) #

# MAC algorithms

newtype 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

HMAC |
Fields hmacGetDigest :: Digest a

Instances

Eq (HMAC a) # |
Instance details Defined in Crypto.Hash Methods (==) :: HMAC a -> HMAC a -> Bool # (/=) :: HMAC a -> HMAC a -> Bool #
Byteable (HMAC a) # |
Instance details Defined in Crypto.Hash Methods toBytes :: HMAC a -> ByteString # byteableLength :: HMAC a -> Int # withBytePtr :: HMAC a -> (Ptr Word8 -> IO b) -> IO b #

hmac #

Arguments

:: HashAlgorithm a |
=> ByteString | Secret key
-> ByteString | Message to MAC
-> HMAC a |

compute a MAC using the supplied hashing function

hmacAlg #

Arguments

:: HashAlgorithm a |
=> a | the hash algorithm the actual value is unused.
-> ByteString | Secret key
-> ByteString | Message to MAC
-> HMAC a |

compute a HMAC using a specified algorithm