Portability | unknown |
---|---|
Stability | experimental |
Maintainer | Vincent Hanquez <vincent@snarc.org> |
Safe Haskell | Trustworthy |
Crypto hash types definitions
- 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 whereSource
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
hashBlockSize :: Context a -> IntSource
Block size in bytes the hash algorithm operates on
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.
Represent a context for a given hash algorithm.
Represent a digest for a given hash algorithm.
deprecated
contextToByteString :: Context a -> ByteStringSource
return the binary bytestring. deprecated use toBytes.
digestToByteString :: Digest a -> ByteStringSource
Deprecated: use toBytes from byteable:Data.Byteable
return the binary bytestring. deprecated use toBytes.