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

Portability | unknown
Stability | experimental
Maintainer | Vincent Hanquez <vincent@snarc.org>
Safe Haskell | Trustworthy

Crypto.Hash.Types

Contents

- deprecated

Description

Crypto hash types definitions

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)
- newtype Context a = Context ByteString
- newtype Digest a = Digest ByteString
- contextToByteString :: Context a -> ByteString
- digestToByteString :: Digest a -> ByteString

# Documentation

class HashAlgorithm a where Source

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 Source

Block size in bytes the hash algorithm operates on

hashInit :: Context aSource

Initialize a new context for this hash algorithm

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

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

hashFinalize :: Context a -> Digest aSource

Finalize a context and return a digest.

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

Try to convert a binary digest bytestring to a digest.

Instances

HashAlgorithm Skein512_512 |
HashAlgorithm Skein512_384 |
HashAlgorithm Skein512_256 |
HashAlgorithm Skein512_224 |
HashAlgorithm Skein256_256 |
HashAlgorithm Skein256_224 |
HashAlgorithm SHA3_512 |
HashAlgorithm SHA3_384 |
HashAlgorithm SHA3_256 |
HashAlgorithm SHA3_224 |
HashAlgorithm Tiger |
HashAlgorithm Whirlpool |
HashAlgorithm RIPEMD160 |
HashAlgorithm SHA512 |
HashAlgorithm SHA384 |
HashAlgorithm SHA256 |
HashAlgorithm SHA224 |
HashAlgorithm SHA1 |
HashAlgorithm MD5 |
HashAlgorithm MD4 |
HashAlgorithm MD2 |

newtype Context a Source

Represent a context for a given hash algorithm.

Constructors

Context ByteString |

Instances

Byteable (Context a) |

newtype Digest a Source

Represent a digest for a given hash algorithm.

Constructors

Digest ByteString |

Instances

Eq (Digest a) |
Ord (Digest a) |
Show (Digest a) |
Byteable (Digest a) |

# deprecated

contextToByteString :: Context a -> ByteString Source

return the binary bytestring. deprecated use toBytes.

digestToByteString :: Digest a -> ByteString Source

Deprecated: use toBytes from byteable:Data.Byteable

return the binary bytestring. deprecated use toBytes.