cryptonite-0.23: Cryptography Primitives sink

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

Crypto.Hash.IO

Description

Generalized impure cryptographic hash interface

Synopsis

- class HashAlgorithm a where
- data MutableContext a
- hashMutableInit :: HashAlgorithm alg => IO (MutableContext alg)
- hashMutableInitWith :: HashAlgorithm alg => alg -> IO (MutableContext alg)
- hashMutableUpdate :: (ByteArrayAccess ba, HashAlgorithm a) => MutableContext a -> ba -> IO ()
- hashMutableFinalize :: forall a. HashAlgorithm a => MutableContext a -> IO (Digest a)
- hashMutableReset :: HashAlgorithm a => MutableContext a -> IO ()

# Documentation

class HashAlgorithm a where Source #

Class representing hashing algorithms.

The interface presented here is update in place and lowlevel. the Hash module takes care of hidding the mutable interface properly.

Minimal complete definition

hashBlockSize, hashDigestSize, hashInternalContextSize, hashInternalInit, hashInternalUpdate, hashInternalFinalize

Methods

hashBlockSize :: a -> Int Source #

Get the block size of a hash algorithm

hashDigestSize :: a -> Int Source #

Get the digest size of a hash algorithm

hashInternalContextSize :: a -> Int Source #

Get the size of the context used for a hash algorithm

hashInternalInit :: Ptr (Context a) -> IO () Source #

Initialize a context pointer to the initial state of a hash algorithm

hashInternalUpdate :: Ptr (Context a) -> Ptr Word8 -> Word32 -> IO () Source #

Update the context with some raw data

hashInternalFinalize :: Ptr (Context a) -> Ptr (Digest a) -> IO () Source #

Finalize the context and set the digest raw memory to the right value

Instances

HashAlgorithm Whirlpool Source # |
Methods hashBlockSize :: Whirlpool -> Int Source # hashDigestSize :: Whirlpool -> Int Source # hashInternalContextSize :: Whirlpool -> Int Source # hashInternalInit :: Ptr (Context Whirlpool) -> IO () Source # hashInternalUpdate :: Ptr (Context Whirlpool) -> Ptr Word8 -> Word32 -> IO () Source # hashInternalFinalize :: Ptr (Context Whirlpool) -> Ptr (Digest Whirlpool) -> IO () Source #
HashAlgorithm Tiger Source # |
Methods hashBlockSize :: Tiger -> Int Source # hashDigestSize :: Tiger -> Int Source # hashInternalContextSize :: Tiger -> Int Source # hashInternalInit :: Ptr (Context Tiger) -> IO () Source # hashInternalUpdate :: Ptr (Context Tiger) -> Ptr Word8 -> Word32 -> IO () Source # hashInternalFinalize :: Ptr (Context Tiger) -> Ptr (Digest Tiger) -> IO () Source #
HashAlgorithm Skein512_512 Source # |

Methods

hashBlockSize :: Skein512_512 -> Int Source #

hashDigestSize :: Skein512_512 -> Int Source #

hashInternalContextSize :: Skein512_512 -> Int Source #

hashInternalInit :: Ptr (Context Skein512_512) -> IO () Source #

hashInternalUpdate :: Ptr (Context Skein512_512) -> Ptr Word8 -> Word32 -> IO () Source #

hashInternalFinalize :: Ptr (Context Skein512_512) -> Ptr (Digest Skein512_512) -> IO () Source #

HashAlgorithm Skein512_384 Source # |

Methods

hashBlockSize :: Skein512_384 -> Int Source #

hashDigestSize :: Skein512_384 -> Int Source #

hashInternalContextSize :: Skein512_384 -> Int Source #

hashInternalInit :: Ptr (Context Skein512_384) -> IO () Source #

hashInternalUpdate :: Ptr (Context Skein512_384) -> Ptr Word8 -> Word32 -> IO () Source #

hashInternalFinalize :: Ptr (Context Skein512_384) -> Ptr (Digest Skein512_384) -> IO () Source #

HashAlgorithm Skein512_256 Source # |

Methods

hashBlockSize :: Skein512_256 -> Int Source #

hashDigestSize :: Skein512_256 -> Int Source #

hashInternalContextSize :: Skein512_256 -> Int Source #

hashInternalInit :: Ptr (Context Skein512_256) -> IO () Source #

hashInternalUpdate :: Ptr (Context Skein512_256) -> Ptr Word8 -> Word32 -> IO () Source #

hashInternalFinalize :: Ptr (Context Skein512_256) -> Ptr (Digest Skein512_256) -> IO () Source #

HashAlgorithm Skein512_224 Source # |

Methods

hashBlockSize :: Skein512_224 -> Int Source #

hashDigestSize :: Skein512_224 -> Int Source #

hashInternalContextSize :: Skein512_224 -> Int Source #

hashInternalInit :: Ptr (Context Skein512_224) -> IO () Source #

hashInternalUpdate :: Ptr (Context Skein512_224) -> Ptr Word8 -> Word32 -> IO () Source #

hashInternalFinalize :: Ptr (Context Skein512_224) -> Ptr (Digest Skein512_224) -> IO () Source #

HashAlgorithm Skein256_256 Source # |

Methods

hashBlockSize :: Skein256_256 -> Int Source #

hashDigestSize :: Skein256_256 -> Int Source #

hashInternalContextSize :: Skein256_256 -> Int Source #

hashInternalInit :: Ptr (Context Skein256_256) -> IO () Source #

hashInternalUpdate :: Ptr (Context Skein256_256) -> Ptr Word8 -> Word32 -> IO () Source #

hashInternalFinalize :: Ptr (Context Skein256_256) -> Ptr (Digest Skein256_256) -> IO () Source #

HashAlgorithm Skein256_224 Source # |

Methods

hashBlockSize :: Skein256_224 -> Int Source #

hashDigestSize :: Skein256_224 -> Int Source #

hashInternalContextSize :: Skein256_224 -> Int Source #

hashInternalInit :: Ptr (Context Skein256_224) -> IO () Source #

hashInternalUpdate :: Ptr (Context Skein256_224) -> Ptr Word8 -> Word32 -> IO () Source #

hashInternalFinalize :: Ptr (Context Skein256_224) -> Ptr (Digest Skein256_224) -> IO () Source #

HashAlgorithm SHA512t_256 Source # |

Methods

hashBlockSize :: SHA512t_256 -> Int Source #

hashDigestSize :: SHA512t_256 -> Int Source #

hashInternalContextSize :: SHA512t_256 -> Int Source #

hashInternalInit :: Ptr (Context SHA512t_256) -> IO () Source #

hashInternalUpdate :: Ptr (Context SHA512t_256) -> Ptr Word8 -> Word32 -> IO () Source #

hashInternalFinalize :: Ptr (Context SHA512t_256) -> Ptr (Digest SHA512t_256) -> IO () Source #

HashAlgorithm SHA512t_224 Source # |

Methods

hashBlockSize :: SHA512t_224 -> Int Source #

hashDigestSize :: SHA512t_224 -> Int Source #

hashInternalContextSize :: SHA512t_224 -> Int Source #

hashInternalInit :: Ptr (Context SHA512t_224) -> IO () Source #

hashInternalUpdate :: Ptr (Context SHA512t_224) -> Ptr Word8 -> Word32 -> IO () Source #

hashInternalFinalize :: Ptr (Context SHA512t_224) -> Ptr (Digest SHA512t_224) -> IO () Source #

HashAlgorithm SHA512 Source # |
Methods hashBlockSize :: SHA512 -> Int Source # hashDigestSize :: SHA512 -> Int Source # hashInternalContextSize :: SHA512 -> Int Source # hashInternalInit :: Ptr (Context SHA512) -> IO () Source # hashInternalUpdate :: Ptr (Context SHA512) -> Ptr Word8 -> Word32 -> IO () Source # hashInternalFinalize :: Ptr (Context SHA512) -> Ptr (Digest SHA512) -> IO () Source #
HashAlgorithm SHA384 Source # |
Methods hashBlockSize :: SHA384 -> Int Source # hashDigestSize :: SHA384 -> Int Source # hashInternalContextSize :: SHA384 -> Int Source # hashInternalInit :: Ptr (Context SHA384) -> IO () Source # hashInternalUpdate :: Ptr (Context SHA384) -> Ptr Word8 -> Word32 -> IO () Source # hashInternalFinalize :: Ptr (Context SHA384) -> Ptr (Digest SHA384) -> IO () Source #
HashAlgorithm SHA3_512 Source # |
Methods hashBlockSize :: SHA3_512 -> Int Source # hashDigestSize :: SHA3_512 -> Int Source # hashInternalContextSize :: SHA3_512 -> Int Source # hashInternalInit :: Ptr (Context SHA3_512) -> IO () Source # hashInternalUpdate :: Ptr (Context SHA3_512) -> Ptr Word8 -> Word32 -> IO () Source # hashInternalFinalize :: Ptr (Context SHA3_512) -> Ptr (Digest SHA3_512) -> IO () Source #
HashAlgorithm SHA3_384 Source # |
Methods hashBlockSize :: SHA3_384 -> Int Source # hashDigestSize :: SHA3_384 -> Int Source # hashInternalContextSize :: SHA3_384 -> Int Source # hashInternalInit :: Ptr (Context SHA3_384) -> IO () Source # hashInternalUpdate :: Ptr (Context SHA3_384) -> Ptr Word8 -> Word32 -> IO () Source # hashInternalFinalize :: Ptr (Context SHA3_384) -> Ptr (Digest SHA3_384) -> IO () Source #
HashAlgorithm SHA3_256 Source # |
Methods hashBlockSize :: SHA3_256 -> Int Source # hashDigestSize :: SHA3_256 -> Int Source # hashInternalContextSize :: SHA3_256 -> Int Source # hashInternalInit :: Ptr (Context SHA3_256) -> IO () Source # hashInternalUpdate :: Ptr (Context SHA3_256) -> Ptr Word8 -> Word32 -> IO () Source # hashInternalFinalize :: Ptr (Context SHA3_256) -> Ptr (Digest SHA3_256) -> IO () Source #
HashAlgorithm SHA3_224 Source # |
Methods hashBlockSize :: SHA3_224 -> Int Source # hashDigestSize :: SHA3_224 -> Int Source # hashInternalContextSize :: SHA3_224 -> Int Source # hashInternalInit :: Ptr (Context SHA3_224) -> IO () Source # hashInternalUpdate :: Ptr (Context SHA3_224) -> Ptr Word8 -> Word32 -> IO () Source # hashInternalFinalize :: Ptr (Context SHA3_224) -> Ptr (Digest SHA3_224) -> IO () Source #
HashAlgorithm SHA256 Source # |
Methods hashBlockSize :: SHA256 -> Int Source # hashDigestSize :: SHA256 -> Int Source # hashInternalContextSize :: SHA256 -> Int Source # hashInternalInit :: Ptr (Context SHA256) -> IO () Source # hashInternalUpdate :: Ptr (Context SHA256) -> Ptr Word8 -> Word32 -> IO () Source # hashInternalFinalize :: Ptr (Context SHA256) -> Ptr (Digest SHA256) -> IO () Source #
HashAlgorithm SHA224 Source # |
Methods hashBlockSize :: SHA224 -> Int Source # hashDigestSize :: SHA224 -> Int Source # hashInternalContextSize :: SHA224 -> Int Source # hashInternalInit :: Ptr (Context SHA224) -> IO () Source # hashInternalUpdate :: Ptr (Context SHA224) -> Ptr Word8 -> Word32 -> IO () Source # hashInternalFinalize :: Ptr (Context SHA224) -> Ptr (Digest SHA224) -> IO () Source #
HashAlgorithm SHA1 Source # |
Methods hashBlockSize :: SHA1 -> Int Source # hashDigestSize :: SHA1 -> Int Source # hashInternalContextSize :: SHA1 -> Int Source # hashInternalInit :: Ptr (Context SHA1) -> IO () Source # hashInternalUpdate :: Ptr (Context SHA1) -> Ptr Word8 -> Word32 -> IO () Source # hashInternalFinalize :: Ptr (Context SHA1) -> Ptr (Digest SHA1) -> IO () Source #
HashAlgorithm RIPEMD160 Source # |
Methods hashBlockSize :: RIPEMD160 -> Int Source # hashDigestSize :: RIPEMD160 -> Int Source # hashInternalContextSize :: RIPEMD160 -> Int Source # hashInternalInit :: Ptr (Context RIPEMD160) -> IO () Source # hashInternalUpdate :: Ptr (Context RIPEMD160) -> Ptr Word8 -> Word32 -> IO () Source # hashInternalFinalize :: Ptr (Context RIPEMD160) -> Ptr (Digest RIPEMD160) -> IO () Source #
HashAlgorithm MD5 Source # |
Methods hashBlockSize :: MD5 -> Int Source # hashDigestSize :: MD5 -> Int Source # hashInternalContextSize :: MD5 -> Int Source # hashInternalInit :: Ptr (Context MD5) -> IO () Source # hashInternalUpdate :: Ptr (Context MD5) -> Ptr Word8 -> Word32 -> IO () Source # hashInternalFinalize :: Ptr (Context MD5) -> Ptr (Digest MD5) -> IO () Source #
HashAlgorithm MD4 Source # |
Methods hashBlockSize :: MD4 -> Int Source # hashDigestSize :: MD4 -> Int Source # hashInternalContextSize :: MD4 -> Int Source # hashInternalInit :: Ptr (Context MD4) -> IO () Source # hashInternalUpdate :: Ptr (Context MD4) -> Ptr Word8 -> Word32 -> IO () Source # hashInternalFinalize :: Ptr (Context MD4) -> Ptr (Digest MD4) -> IO () Source #
HashAlgorithm MD2 Source # |
Methods hashBlockSize :: MD2 -> Int Source # hashDigestSize :: MD2 -> Int Source # hashInternalContextSize :: MD2 -> Int Source # hashInternalInit :: Ptr (Context MD2) -> IO () Source # hashInternalUpdate :: Ptr (Context MD2) -> Ptr Word8 -> Word32 -> IO () Source # hashInternalFinalize :: Ptr (Context MD2) -> Ptr (Digest MD2) -> IO () Source #
HashAlgorithm Keccak_512 Source # |
Methods hashBlockSize :: Keccak_512 -> Int Source # hashDigestSize :: Keccak_512 -> Int Source # hashInternalContextSize :: Keccak_512 -> Int Source # hashInternalInit :: Ptr (Context Keccak_512) -> IO () Source # hashInternalUpdate :: Ptr (Context Keccak_512) -> Ptr Word8 -> Word32 -> IO () Source # hashInternalFinalize :: Ptr (Context Keccak_512) -> Ptr (Digest Keccak_512) -> IO () Source #
HashAlgorithm Keccak_384 Source # |
Methods hashBlockSize :: Keccak_384 -> Int Source # hashDigestSize :: Keccak_384 -> Int Source # hashInternalContextSize :: Keccak_384 -> Int Source # hashInternalInit :: Ptr (Context Keccak_384) -> IO () Source # hashInternalUpdate :: Ptr (Context Keccak_384) -> Ptr Word8 -> Word32 -> IO () Source # hashInternalFinalize :: Ptr (Context Keccak_384) -> Ptr (Digest Keccak_384) -> IO () Source #
HashAlgorithm Keccak_256 Source # |
Methods hashBlockSize :: Keccak_256 -> Int Source # hashDigestSize :: Keccak_256 -> Int Source # hashInternalContextSize :: Keccak_256 -> Int Source # hashInternalInit :: Ptr (Context Keccak_256) -> IO () Source # hashInternalUpdate :: Ptr (Context Keccak_256) -> Ptr Word8 -> Word32 -> IO () Source # hashInternalFinalize :: Ptr (Context Keccak_256) -> Ptr (Digest Keccak_256) -> IO () Source #
HashAlgorithm Keccak_224 Source # |
Methods hashBlockSize :: Keccak_224 -> Int Source # hashDigestSize :: Keccak_224 -> Int Source # hashInternalContextSize :: Keccak_224 -> Int Source # hashInternalInit :: Ptr (Context Keccak_224) -> IO () Source # hashInternalUpdate :: Ptr (Context Keccak_224) -> Ptr Word8 -> Word32 -> IO () Source # hashInternalFinalize :: Ptr (Context Keccak_224) -> Ptr (Digest Keccak_224) -> IO () Source #
HashAlgorithm Blake2sp_256 Source # |

Methods

hashBlockSize :: Blake2sp_256 -> Int Source #

hashDigestSize :: Blake2sp_256 -> Int Source #

hashInternalContextSize :: Blake2sp_256 -> Int Source #

hashInternalInit :: Ptr (Context Blake2sp_256) -> IO () Source #

hashInternalUpdate :: Ptr (Context Blake2sp_256) -> Ptr Word8 -> Word32 -> IO () Source #

hashInternalFinalize :: Ptr (Context Blake2sp_256) -> Ptr (Digest Blake2sp_256) -> IO () Source #

HashAlgorithm Blake2sp_224 Source # |

Methods

hashBlockSize :: Blake2sp_224 -> Int Source #

hashDigestSize :: Blake2sp_224 -> Int Source #

hashInternalContextSize :: Blake2sp_224 -> Int Source #

hashInternalInit :: Ptr (Context Blake2sp_224) -> IO () Source #

hashInternalUpdate :: Ptr (Context Blake2sp_224) -> Ptr Word8 -> Word32 -> IO () Source #

hashInternalFinalize :: Ptr (Context Blake2sp_224) -> Ptr (Digest Blake2sp_224) -> IO () Source #

HashAlgorithm Blake2s_256 Source # |

Methods

hashBlockSize :: Blake2s_256 -> Int Source #

hashDigestSize :: Blake2s_256 -> Int Source #

hashInternalContextSize :: Blake2s_256 -> Int Source #

hashInternalInit :: Ptr (Context Blake2s_256) -> IO () Source #

hashInternalUpdate :: Ptr (Context Blake2s_256) -> Ptr Word8 -> Word32 -> IO () Source #

hashInternalFinalize :: Ptr (Context Blake2s_256) -> Ptr (Digest Blake2s_256) -> IO () Source #

HashAlgorithm Blake2s_224 Source # |

Methods

hashBlockSize :: Blake2s_224 -> Int Source #

hashDigestSize :: Blake2s_224 -> Int Source #

hashInternalContextSize :: Blake2s_224 -> Int Source #

hashInternalInit :: Ptr (Context Blake2s_224) -> IO () Source #

hashInternalUpdate :: Ptr (Context Blake2s_224) -> Ptr Word8 -> Word32 -> IO () Source #

hashInternalFinalize :: Ptr (Context Blake2s_224) -> Ptr (Digest Blake2s_224) -> IO () Source #

HashAlgorithm Blake2s_160 Source # |

Methods

hashBlockSize :: Blake2s_160 -> Int Source #

hashDigestSize :: Blake2s_160 -> Int Source #

hashInternalContextSize :: Blake2s_160 -> Int Source #

hashInternalInit :: Ptr (Context Blake2s_160) -> IO () Source #

hashInternalUpdate :: Ptr (Context Blake2s_160) -> Ptr Word8 -> Word32 -> IO () Source #

hashInternalFinalize :: Ptr (Context Blake2s_160) -> Ptr (Digest Blake2s_160) -> IO () Source #

HashAlgorithm Blake2bp_512 Source # |

Methods

hashBlockSize :: Blake2bp_512 -> Int Source #

hashDigestSize :: Blake2bp_512 -> Int Source #

hashInternalContextSize :: Blake2bp_512 -> Int Source #

hashInternalInit :: Ptr (Context Blake2bp_512) -> IO () Source #

hashInternalUpdate :: Ptr (Context Blake2bp_512) -> Ptr Word8 -> Word32 -> IO () Source #

hashInternalFinalize :: Ptr (Context Blake2bp_512) -> Ptr (Digest Blake2bp_512) -> IO () Source #

HashAlgorithm Blake2b_512 Source # |

Methods

hashBlockSize :: Blake2b_512 -> Int Source #

hashDigestSize :: Blake2b_512 -> Int Source #

hashInternalContextSize :: Blake2b_512 -> Int Source #

hashInternalInit :: Ptr (Context Blake2b_512) -> IO () Source #

hashInternalUpdate :: Ptr (Context Blake2b_512) -> Ptr Word8 -> Word32 -> IO () Source #

hashInternalFinalize :: Ptr (Context Blake2b_512) -> Ptr (Digest Blake2b_512) -> IO () Source #

HashAlgorithm Blake2b_384 Source # |

Methods

hashBlockSize :: Blake2b_384 -> Int Source #

hashDigestSize :: Blake2b_384 -> Int Source #

hashInternalContextSize :: Blake2b_384 -> Int Source #

hashInternalInit :: Ptr (Context Blake2b_384) -> IO () Source #

hashInternalUpdate :: Ptr (Context Blake2b_384) -> Ptr Word8 -> Word32 -> IO () Source #

hashInternalFinalize :: Ptr (Context Blake2b_384) -> Ptr (Digest Blake2b_384) -> IO () Source #

HashAlgorithm Blake2b_256 Source # |

Methods

hashBlockSize :: Blake2b_256 -> Int Source #

hashDigestSize :: Blake2b_256 -> Int Source #

hashInternalContextSize :: Blake2b_256 -> Int Source #

hashInternalInit :: Ptr (Context Blake2b_256) -> IO () Source #

hashInternalUpdate :: Ptr (Context Blake2b_256) -> Ptr Word8 -> Word32 -> IO () Source #

hashInternalFinalize :: Ptr (Context Blake2b_256) -> Ptr (Digest Blake2b_256) -> IO () Source #

HashAlgorithm Blake2b_224 Source # |

Methods

hashBlockSize :: Blake2b_224 -> Int Source #

hashDigestSize :: Blake2b_224 -> Int Source #

hashInternalContextSize :: Blake2b_224 -> Int Source #

hashInternalInit :: Ptr (Context Blake2b_224) -> IO () Source #

hashInternalUpdate :: Ptr (Context Blake2b_224) -> Ptr Word8 -> Word32 -> IO () Source #

hashInternalFinalize :: Ptr (Context Blake2b_224) -> Ptr (Digest Blake2b_224) -> IO () Source #

HashAlgorithm Blake2b_160 Source # |

Methods

hashBlockSize :: Blake2b_160 -> Int Source #

hashDigestSize :: Blake2b_160 -> Int Source #

hashInternalContextSize :: Blake2b_160 -> Int Source #

hashInternalInit :: Ptr (Context Blake2b_160) -> IO () Source #

hashInternalUpdate :: Ptr (Context Blake2b_160) -> Ptr Word8 -> Word32 -> IO () Source #

hashInternalFinalize :: Ptr (Context Blake2b_160) -> Ptr (Digest Blake2b_160) -> IO () Source #

(IsDivisibleBy8 bitLen, KnownNat bitLen) => HashAlgorithm (SHAKE256 bitLen) Source # |

Methods

hashBlockSize :: SHAKE256 bitLen -> Int Source #

hashDigestSize :: SHAKE256 bitLen -> Int Source #

hashInternalContextSize :: SHAKE256 bitLen -> Int Source #

hashInternalInit :: Ptr (Context (SHAKE256 bitLen)) -> IO () Source #

hashInternalUpdate :: Ptr (Context (SHAKE256 bitLen)) -> Ptr Word8 -> Word32 -> IO () Source #

hashInternalFinalize :: Ptr (Context (SHAKE256 bitLen)) -> Ptr (Digest (SHAKE256 bitLen)) -> IO () Source #

(IsDivisibleBy8 bitLen, KnownNat bitLen) => HashAlgorithm (SHAKE128 bitLen) Source # |

Methods

hashBlockSize :: SHAKE128 bitLen -> Int Source #

hashDigestSize :: SHAKE128 bitLen -> Int Source #

hashInternalContextSize :: SHAKE128 bitLen -> Int Source #

hashInternalInit :: Ptr (Context (SHAKE128 bitLen)) -> IO () Source #

hashInternalUpdate :: Ptr (Context (SHAKE128 bitLen)) -> Ptr Word8 -> Word32 -> IO () Source #

hashInternalFinalize :: Ptr (Context (SHAKE128 bitLen)) -> Ptr (Digest (SHAKE128 bitLen)) -> IO () Source #

(IsDivisibleBy8 bitlen, KnownNat bitlen, IsAtLeast bitlen 8, IsAtMost bitlen 512) => HashAlgorithm (Blake2bp bitlen) Source # |

Methods

hashBlockSize :: Blake2bp bitlen -> Int Source #

hashDigestSize :: Blake2bp bitlen -> Int Source #

hashInternalContextSize :: Blake2bp bitlen -> Int Source #

hashInternalInit :: Ptr (Context (Blake2bp bitlen)) -> IO () Source #

hashInternalUpdate :: Ptr (Context (Blake2bp bitlen)) -> Ptr Word8 -> Word32 -> IO () Source #

hashInternalFinalize :: Ptr (Context (Blake2bp bitlen)) -> Ptr (Digest (Blake2bp bitlen)) -> IO () Source #

(IsDivisibleBy8 bitlen, KnownNat bitlen, IsAtLeast bitlen 8, IsAtMost bitlen 256) => HashAlgorithm (Blake2sp bitlen) Source # |

Methods

hashBlockSize :: Blake2sp bitlen -> Int Source #

hashDigestSize :: Blake2sp bitlen -> Int Source #

hashInternalContextSize :: Blake2sp bitlen -> Int Source #

hashInternalInit :: Ptr (Context (Blake2sp bitlen)) -> IO () Source #

hashInternalUpdate :: Ptr (Context (Blake2sp bitlen)) -> Ptr Word8 -> Word32 -> IO () Source #

hashInternalFinalize :: Ptr (Context (Blake2sp bitlen)) -> Ptr (Digest (Blake2sp bitlen)) -> IO () Source #

(IsDivisibleBy8 bitlen, KnownNat bitlen, IsAtLeast bitlen 8, IsAtMost bitlen 512) => HashAlgorithm (Blake2b bitlen) Source # |

Methods

hashBlockSize :: Blake2b bitlen -> Int Source #

hashDigestSize :: Blake2b bitlen -> Int Source #

hashInternalContextSize :: Blake2b bitlen -> Int Source #

hashInternalInit :: Ptr (Context (Blake2b bitlen)) -> IO () Source #

hashInternalUpdate :: Ptr (Context (Blake2b bitlen)) -> Ptr Word8 -> Word32 -> IO () Source #

hashInternalFinalize :: Ptr (Context (Blake2b bitlen)) -> Ptr (Digest (Blake2b bitlen)) -> IO () Source #

(IsDivisibleBy8 bitlen, KnownNat bitlen, IsAtLeast bitlen 8, IsAtMost bitlen 256) => HashAlgorithm (Blake2s bitlen) Source # |

Methods

hashBlockSize :: Blake2s bitlen -> Int Source #

hashDigestSize :: Blake2s bitlen -> Int Source #

hashInternalContextSize :: Blake2s bitlen -> Int Source #

hashInternalInit :: Ptr (Context (Blake2s bitlen)) -> IO () Source #

hashInternalUpdate :: Ptr (Context (Blake2s bitlen)) -> Ptr Word8 -> Word32 -> IO () Source #

hashInternalFinalize :: Ptr (Context (Blake2s bitlen)) -> Ptr (Digest (Blake2s bitlen)) -> IO () Source #

data MutableContext a Source #

A Mutable hash context

Instances

ByteArrayAccess (MutableContext a) Source # |
Methods length :: MutableContext a -> Int # withByteArray :: MutableContext a -> (Ptr p -> IO a) -> IO a #

hashMutableInit :: HashAlgorithm alg => IO (MutableContext alg) Source #

Create a new mutable hash context.

the algorithm used is automatically determined from the return constraint.

hashMutableInitWith :: HashAlgorithm alg => alg -> IO (MutableContext alg) Source #

Create a new mutable hash context.

The algorithm is explicitely passed as parameter

hashMutableUpdate :: (ByteArrayAccess ba, HashAlgorithm a) => MutableContext a -> ba -> IO () Source #

Update a mutable hash context in place

hashMutableFinalize :: forall a. HashAlgorithm a => MutableContext a -> IO (Digest a) Source #

Finalize a mutable hash context and compute a digest

hashMutableReset :: HashAlgorithm a => MutableContext a -> IO () Source #

Reset the mutable context to the initial state of the hash