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

Portabilityunknown
Stabilityexperimental
MaintainerVincent Hanquez <vincent@snarc.org>
Safe HaskellTrustworthy

Crypto.Hash

Contents

Description

Crypto hash main module

Synopsis

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

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.

data Context a

Represent a context for a given hash algorithm.

data Digest a

Represent a digest for a given hash algorithm.

Instances

Eq (Digest a) 
Eq (Digest a) => Ord (Digest a) 
Show (Digest a) 

Functions

digestToByteString :: Digest a -> ByteString

Return the binary digest

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.

hash algorithms

data MD2

Instances

data MD4

Instances

data MD5

Instances

data SHA1

Instances

data SHA224

data SHA256

data SHA384

data SHA512

data Tiger

Instances