cryptohash-0.11.6: 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.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 hashing context
- updates : update the hashing context with some strict bytestrings and return the new context
- finalize : finalize the context into a digest

Methods

hashBlockSize :: Context a -> Int Source

Block size in bytes the hash algorithm operates on

hashInit :: Context a Source

Initialize a new context for this hash algorithm

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

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

hashFinalize :: Context a -> Digest a Source

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 Source |
HashAlgorithm Skein512_384 Source |
HashAlgorithm Skein512_256 Source |
HashAlgorithm Skein512_224 Source |
HashAlgorithm Skein256_256 Source |
HashAlgorithm Skein256_224 Source |
HashAlgorithm SHA3_512 Source |
HashAlgorithm SHA3_384 Source |
HashAlgorithm SHA3_256 Source |
HashAlgorithm SHA3_224 Source |
HashAlgorithm Tiger Source |
HashAlgorithm Whirlpool Source |
HashAlgorithm RIPEMD160 Source |
HashAlgorithm SHA512 Source |
HashAlgorithm SHA384 Source |
HashAlgorithm SHA256 Source |
HashAlgorithm SHA224 Source |
HashAlgorithm SHA1 Source |
HashAlgorithm MD5 Source |
HashAlgorithm MD4 Source |
HashAlgorithm MD2 Source |

newtype Context a Source

Represent a context for a given hash algorithm.

Constructors

Context ByteString |

Instances

Byteable (Context a) Source |

newtype Digest a Source

Represent a digest for a given hash algorithm.

Constructors

Digest ByteString |

Instances

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

# 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.