Crypto.Hash.IO

crypton-1.0.1: 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
  - type HashBlockSize a :: Nat
  - type HashDigestSize a :: Nat
  - type HashInternalContextSize a :: Nat
  - hashBlockSize :: a -> Int
  - hashDigestSize :: a -> Int
  - hashInternalContextSize :: a -> Int
  - hashInternalInit :: Ptr (Context a) -> IO ()
  - hashInternalUpdate :: Ptr (Context a) -> Ptr Word8 -> Word32 -> IO ()
  - hashInternalFinalize :: Ptr (Context a) -> Ptr (Digest a) -> IO ()
- 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 :: HashAlgorithm a => MutableContext a -> IO (Digest a)
- hashMutableReset :: HashAlgorithm a => MutableContext a -> IO ()

# Documentation

class HashAlgorithm a where #

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.

Associated Types

type HashBlockSize a :: Nat #

Associated type for the block size of the hash algorithm

type HashDigestSize a :: Nat #

Associated type for the digest size of the hash algorithm

type HashInternalContextSize a :: Nat #

Associated type for the internal context size of the hash algorithm

Methods

hashBlockSize :: a -> Int #

Get the block size of a hash algorithm

hashDigestSize :: a -> Int #

Get the digest size of a hash algorithm

hashInternalContextSize :: a -> Int #

Get the size of the context used for a hash algorithm

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

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

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

Update the context with some raw data

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

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

#### Instances

Instances details

HashAlgorithm Blake2b_160 # |
Instance details Defined in Crypto.Hash.Blake2b Associated Types
type HashBlockSize Blake2b_160 |
Instance details Defined in Crypto.Hash.Blake2b type HashBlockSize Blake2b_160 = 128
type HashDigestSize Blake2b_160 |
Instance details Defined in Crypto.Hash.Blake2b type HashDigestSize Blake2b_160 = 20
type HashInternalContextSize Blake2b_160 |
Instance details Defined in Crypto.Hash.Blake2b type HashInternalContextSize Blake2b_160 = 248
Methods hashBlockSize :: Blake2b_160 -> Int # hashDigestSize :: Blake2b_160 -> Int # hashInternalContextSize :: Blake2b_160 -> Int # hashInternalInit :: Ptr (Context Blake2b_160) -> IO () # hashInternalUpdate :: Ptr (Context Blake2b_160) -> Ptr Word8 -> Word32 -> IO () # hashInternalFinalize :: Ptr (Context Blake2b_160) -> Ptr (Digest Blake2b_160) -> IO () #
HashAlgorithm Blake2b_224 # |
Instance details Defined in Crypto.Hash.Blake2b Associated Types
type HashBlockSize Blake2b_224 |
Instance details Defined in Crypto.Hash.Blake2b type HashBlockSize Blake2b_224 = 128
type HashDigestSize Blake2b_224 |
Instance details Defined in Crypto.Hash.Blake2b type HashDigestSize Blake2b_224 = 28
type HashInternalContextSize Blake2b_224 |
Instance details Defined in Crypto.Hash.Blake2b type HashInternalContextSize Blake2b_224 = 248
Methods hashBlockSize :: Blake2b_224 -> Int # hashDigestSize :: Blake2b_224 -> Int # hashInternalContextSize :: Blake2b_224 -> Int # hashInternalInit :: Ptr (Context Blake2b_224) -> IO () # hashInternalUpdate :: Ptr (Context Blake2b_224) -> Ptr Word8 -> Word32 -> IO () # hashInternalFinalize :: Ptr (Context Blake2b_224) -> Ptr (Digest Blake2b_224) -> IO () #
HashAlgorithm Blake2b_256 # |
Instance details Defined in Crypto.Hash.Blake2b Associated Types
type HashBlockSize Blake2b_256 |
Instance details Defined in Crypto.Hash.Blake2b type HashBlockSize Blake2b_256 = 128
type HashDigestSize Blake2b_256 |
Instance details Defined in Crypto.Hash.Blake2b type HashDigestSize Blake2b_256 = 32
type HashInternalContextSize Blake2b_256 |
Instance details Defined in Crypto.Hash.Blake2b type HashInternalContextSize Blake2b_256 = 248
Methods hashBlockSize :: Blake2b_256 -> Int # hashDigestSize :: Blake2b_256 -> Int # hashInternalContextSize :: Blake2b_256 -> Int # hashInternalInit :: Ptr (Context Blake2b_256) -> IO () # hashInternalUpdate :: Ptr (Context Blake2b_256) -> Ptr Word8 -> Word32 -> IO () # hashInternalFinalize :: Ptr (Context Blake2b_256) -> Ptr (Digest Blake2b_256) -> IO () #
HashAlgorithm Blake2b_384 # |
Instance details Defined in Crypto.Hash.Blake2b Associated Types
type HashBlockSize Blake2b_384 |
Instance details Defined in Crypto.Hash.Blake2b type HashBlockSize Blake2b_384 = 128
type HashDigestSize Blake2b_384 |
Instance details Defined in Crypto.Hash.Blake2b type HashDigestSize Blake2b_384 = 48
type HashInternalContextSize Blake2b_384 |
Instance details Defined in Crypto.Hash.Blake2b type HashInternalContextSize Blake2b_384 = 248
Methods hashBlockSize :: Blake2b_384 -> Int # hashDigestSize :: Blake2b_384 -> Int # hashInternalContextSize :: Blake2b_384 -> Int # hashInternalInit :: Ptr (Context Blake2b_384) -> IO () # hashInternalUpdate :: Ptr (Context Blake2b_384) -> Ptr Word8 -> Word32 -> IO () # hashInternalFinalize :: Ptr (Context Blake2b_384) -> Ptr (Digest Blake2b_384) -> IO () #
HashAlgorithm Blake2b_512 # |
Instance details Defined in Crypto.Hash.Blake2b Associated Types
type HashBlockSize Blake2b_512 |
Instance details Defined in Crypto.Hash.Blake2b type HashBlockSize Blake2b_512 = 128
type HashDigestSize Blake2b_512 |
Instance details Defined in Crypto.Hash.Blake2b type HashDigestSize Blake2b_512 = 64
type HashInternalContextSize Blake2b_512 |
Instance details Defined in Crypto.Hash.Blake2b type HashInternalContextSize Blake2b_512 = 248
Methods hashBlockSize :: Blake2b_512 -> Int # hashDigestSize :: Blake2b_512 -> Int # hashInternalContextSize :: Blake2b_512 -> Int # hashInternalInit :: Ptr (Context Blake2b_512) -> IO () # hashInternalUpdate :: Ptr (Context Blake2b_512) -> Ptr Word8 -> Word32 -> IO () # hashInternalFinalize :: Ptr (Context Blake2b_512) -> Ptr (Digest Blake2b_512) -> IO () #
HashAlgorithm Blake2bp_512 # |
Instance details Defined in Crypto.Hash.Blake2bp Associated Types
type HashBlockSize Blake2bp_512 |
Instance details Defined in Crypto.Hash.Blake2bp type HashBlockSize Blake2bp_512 = 128
type HashDigestSize Blake2bp_512 |
Instance details Defined in Crypto.Hash.Blake2bp type HashDigestSize Blake2bp_512 = 64
type HashInternalContextSize Blake2bp_512 |
Instance details Defined in Crypto.Hash.Blake2bp type HashInternalContextSize Blake2bp_512 = 1768
Methods hashBlockSize :: Blake2bp_512 -> Int # hashDigestSize :: Blake2bp_512 -> Int # hashInternalContextSize :: Blake2bp_512 -> Int # hashInternalInit :: Ptr (Context Blake2bp_512) -> IO () # hashInternalUpdate :: Ptr (Context Blake2bp_512) -> Ptr Word8 -> Word32 -> IO () # hashInternalFinalize :: Ptr (Context Blake2bp_512) -> Ptr (Digest Blake2bp_512) -> IO () #
HashAlgorithm Blake2s_160 # |
Instance details Defined in Crypto.Hash.Blake2s Associated Types
type HashBlockSize Blake2s_160 |
Instance details Defined in Crypto.Hash.Blake2s type HashBlockSize Blake2s_160 = 64
type HashDigestSize Blake2s_160 |
Instance details Defined in Crypto.Hash.Blake2s type HashDigestSize Blake2s_160 = 20
type HashInternalContextSize Blake2s_160 |
Instance details Defined in Crypto.Hash.Blake2s type HashInternalContextSize Blake2s_160 = 136
Methods hashBlockSize :: Blake2s_160 -> Int # hashDigestSize :: Blake2s_160 -> Int # hashInternalContextSize :: Blake2s_160 -> Int # hashInternalInit :: Ptr (Context Blake2s_160) -> IO () # hashInternalUpdate :: Ptr (Context Blake2s_160) -> Ptr Word8 -> Word32 -> IO () # hashInternalFinalize :: Ptr (Context Blake2s_160) -> Ptr (Digest Blake2s_160) -> IO () #
HashAlgorithm Blake2s_224 # |
Instance details Defined in Crypto.Hash.Blake2s Associated Types
type HashBlockSize Blake2s_224 |
Instance details Defined in Crypto.Hash.Blake2s type HashBlockSize Blake2s_224 = 64
type HashDigestSize Blake2s_224 |
Instance details Defined in Crypto.Hash.Blake2s type HashDigestSize Blake2s_224 = 28
type HashInternalContextSize Blake2s_224 |
Instance details Defined in Crypto.Hash.Blake2s type HashInternalContextSize Blake2s_224 = 136
Methods hashBlockSize :: Blake2s_224 -> Int # hashDigestSize :: Blake2s_224 -> Int # hashInternalContextSize :: Blake2s_224 -> Int # hashInternalInit :: Ptr (Context Blake2s_224) -> IO () # hashInternalUpdate :: Ptr (Context Blake2s_224) -> Ptr Word8 -> Word32 -> IO () # hashInternalFinalize :: Ptr (Context Blake2s_224) -> Ptr (Digest Blake2s_224) -> IO () #
HashAlgorithm Blake2s_256 # |
Instance details Defined in Crypto.Hash.Blake2s Associated Types
type HashBlockSize Blake2s_256 |
Instance details Defined in Crypto.Hash.Blake2s type HashBlockSize Blake2s_256 = 64
type HashDigestSize Blake2s_256 |
Instance details Defined in Crypto.Hash.Blake2s type HashDigestSize Blake2s_256 = 32
type HashInternalContextSize Blake2s_256 |
Instance details Defined in Crypto.Hash.Blake2s type HashInternalContextSize Blake2s_256 = 136
Methods hashBlockSize :: Blake2s_256 -> Int # hashDigestSize :: Blake2s_256 -> Int # hashInternalContextSize :: Blake2s_256 -> Int # hashInternalInit :: Ptr (Context Blake2s_256) -> IO () # hashInternalUpdate :: Ptr (Context Blake2s_256) -> Ptr Word8 -> Word32 -> IO () # hashInternalFinalize :: Ptr (Context Blake2s_256) -> Ptr (Digest Blake2s_256) -> IO () #
HashAlgorithm Blake2sp_224 # |
Instance details Defined in Crypto.Hash.Blake2sp Associated Types
type HashBlockSize Blake2sp_224 |
Instance details Defined in Crypto.Hash.Blake2sp type HashBlockSize Blake2sp_224 = 64
type HashDigestSize Blake2sp_224 |
Instance details Defined in Crypto.Hash.Blake2sp type HashDigestSize Blake2sp_224 = 28
type HashInternalContextSize Blake2sp_224 |
Instance details Defined in Crypto.Hash.Blake2sp type HashInternalContextSize Blake2sp_224 = 1752
Methods hashBlockSize :: Blake2sp_224 -> Int # hashDigestSize :: Blake2sp_224 -> Int # hashInternalContextSize :: Blake2sp_224 -> Int # hashInternalInit :: Ptr (Context Blake2sp_224) -> IO () # hashInternalUpdate :: Ptr (Context Blake2sp_224) -> Ptr Word8 -> Word32 -> IO () # hashInternalFinalize :: Ptr (Context Blake2sp_224) -> Ptr (Digest Blake2sp_224) -> IO () #
HashAlgorithm Blake2sp_256 # |
Instance details Defined in Crypto.Hash.Blake2sp Associated Types
type HashBlockSize Blake2sp_256 |
Instance details Defined in Crypto.Hash.Blake2sp type HashBlockSize Blake2sp_256 = 64
type HashDigestSize Blake2sp_256 |
Instance details Defined in Crypto.Hash.Blake2sp type HashDigestSize Blake2sp_256 = 32
type HashInternalContextSize Blake2sp_256 |
Instance details Defined in Crypto.Hash.Blake2sp type HashInternalContextSize Blake2sp_256 = 1752
Methods hashBlockSize :: Blake2sp_256 -> Int # hashDigestSize :: Blake2sp_256 -> Int # hashInternalContextSize :: Blake2sp_256 -> Int # hashInternalInit :: Ptr (Context Blake2sp_256) -> IO () # hashInternalUpdate :: Ptr (Context Blake2sp_256) -> Ptr Word8 -> Word32 -> IO () # hashInternalFinalize :: Ptr (Context Blake2sp_256) -> Ptr (Digest Blake2sp_256) -> IO () #
HashAlgorithm Keccak_224 # |
Instance details Defined in Crypto.Hash.Keccak Associated Types
type HashBlockSize Keccak_224 |
Instance details Defined in Crypto.Hash.Keccak type HashBlockSize Keccak_224 = 144
type HashDigestSize Keccak_224 |
Instance details Defined in Crypto.Hash.Keccak type HashDigestSize Keccak_224 = 28
type HashInternalContextSize Keccak_224 |
Instance details Defined in Crypto.Hash.Keccak type HashInternalContextSize Keccak_224 = 352
Methods hashBlockSize :: Keccak_224 -> Int # hashDigestSize :: Keccak_224 -> Int # hashInternalContextSize :: Keccak_224 -> Int # hashInternalInit :: Ptr (Context Keccak_224) -> IO () # hashInternalUpdate :: Ptr (Context Keccak_224) -> Ptr Word8 -> Word32 -> IO () # hashInternalFinalize :: Ptr (Context Keccak_224) -> Ptr (Digest Keccak_224) -> IO () #
HashAlgorithm Keccak_256 # |
Instance details Defined in Crypto.Hash.Keccak Associated Types
type HashBlockSize Keccak_256 |
Instance details Defined in Crypto.Hash.Keccak type HashBlockSize Keccak_256 = 136
type HashDigestSize Keccak_256 |
Instance details Defined in Crypto.Hash.Keccak type HashDigestSize Keccak_256 = 32
type HashInternalContextSize Keccak_256 |
Instance details Defined in Crypto.Hash.Keccak type HashInternalContextSize Keccak_256 = 344
Methods hashBlockSize :: Keccak_256 -> Int # hashDigestSize :: Keccak_256 -> Int # hashInternalContextSize :: Keccak_256 -> Int # hashInternalInit :: Ptr (Context Keccak_256) -> IO () # hashInternalUpdate :: Ptr (Context Keccak_256) -> Ptr Word8 -> Word32 -> IO () # hashInternalFinalize :: Ptr (Context Keccak_256) -> Ptr (Digest Keccak_256) -> IO () #
HashAlgorithm Keccak_384 # |
Instance details Defined in Crypto.Hash.Keccak Associated Types
type HashBlockSize Keccak_384 |
Instance details Defined in Crypto.Hash.Keccak type HashBlockSize Keccak_384 = 104
type HashDigestSize Keccak_384 |
Instance details Defined in Crypto.Hash.Keccak type HashDigestSize Keccak_384 = 48
type HashInternalContextSize Keccak_384 |
Instance details Defined in Crypto.Hash.Keccak type HashInternalContextSize Keccak_384 = 312
Methods hashBlockSize :: Keccak_384 -> Int # hashDigestSize :: Keccak_384 -> Int # hashInternalContextSize :: Keccak_384 -> Int # hashInternalInit :: Ptr (Context Keccak_384) -> IO () # hashInternalUpdate :: Ptr (Context Keccak_384) -> Ptr Word8 -> Word32 -> IO () # hashInternalFinalize :: Ptr (Context Keccak_384) -> Ptr (Digest Keccak_384) -> IO () #
HashAlgorithm Keccak_512 # |
Instance details Defined in Crypto.Hash.Keccak Associated Types
type HashBlockSize Keccak_512 |
Instance details Defined in Crypto.Hash.Keccak type HashBlockSize Keccak_512 = 72
type HashDigestSize Keccak_512 |
Instance details Defined in Crypto.Hash.Keccak type HashDigestSize Keccak_512 = 64
type HashInternalContextSize Keccak_512 |
Instance details Defined in Crypto.Hash.Keccak type HashInternalContextSize Keccak_512 = 280
Methods hashBlockSize :: Keccak_512 -> Int # hashDigestSize :: Keccak_512 -> Int # hashInternalContextSize :: Keccak_512 -> Int # hashInternalInit :: Ptr (Context Keccak_512) -> IO () # hashInternalUpdate :: Ptr (Context Keccak_512) -> Ptr Word8 -> Word32 -> IO () # hashInternalFinalize :: Ptr (Context Keccak_512) -> Ptr (Digest Keccak_512) -> IO () #
HashAlgorithm MD2 # |
Instance details Defined in Crypto.Hash.MD2 Associated Types
type HashBlockSize MD2 |
Instance details Defined in Crypto.Hash.MD2 type HashBlockSize MD2 = 16
type HashDigestSize MD2 |
Instance details Defined in Crypto.Hash.MD2 type HashDigestSize MD2 = 16
type HashInternalContextSize MD2 |
Instance details Defined in Crypto.Hash.MD2 type HashInternalContextSize MD2 = 96
Methods hashBlockSize :: MD2 -> Int # hashDigestSize :: MD2 -> Int # hashInternalContextSize :: MD2 -> Int # hashInternalInit :: Ptr (Context MD2) -> IO () # hashInternalUpdate :: Ptr (Context MD2) -> Ptr Word8 -> Word32 -> IO () # hashInternalFinalize :: Ptr (Context MD2) -> Ptr (Digest MD2) -> IO () #
HashAlgorithm MD4 # |
Instance details Defined in Crypto.Hash.MD4 Associated Types
type HashBlockSize MD4 |
Instance details Defined in Crypto.Hash.MD4 type HashBlockSize MD4 = 64
type HashDigestSize MD4 |
Instance details Defined in Crypto.Hash.MD4 type HashDigestSize MD4 = 16
type HashInternalContextSize MD4 |
Instance details Defined in Crypto.Hash.MD4 type HashInternalContextSize MD4 = 96
Methods hashBlockSize :: MD4 -> Int # hashDigestSize :: MD4 -> Int # hashInternalContextSize :: MD4 -> Int # hashInternalInit :: Ptr (Context MD4) -> IO () # hashInternalUpdate :: Ptr (Context MD4) -> Ptr Word8 -> Word32 -> IO () # hashInternalFinalize :: Ptr (Context MD4) -> Ptr (Digest MD4) -> IO () #
HashAlgorithm MD5 # |
Instance details Defined in Crypto.Hash.MD5 Associated Types
type HashBlockSize MD5 |
Instance details Defined in Crypto.Hash.MD5 type HashBlockSize MD5 = 64
type HashDigestSize MD5 |
Instance details Defined in Crypto.Hash.MD5 type HashDigestSize MD5 = 16
type HashInternalContextSize MD5 |
Instance details Defined in Crypto.Hash.MD5 type HashInternalContextSize MD5 = 96
Methods hashBlockSize :: MD5 -> Int # hashDigestSize :: MD5 -> Int # hashInternalContextSize :: MD5 -> Int # hashInternalInit :: Ptr (Context MD5) -> IO () # hashInternalUpdate :: Ptr (Context MD5) -> Ptr Word8 -> Word32 -> IO () # hashInternalFinalize :: Ptr (Context MD5) -> Ptr (Digest MD5) -> IO () #
HashAlgorithm RIPEMD160 # |
Instance details Defined in Crypto.Hash.RIPEMD160 Associated Types
type HashBlockSize RIPEMD160 |
Instance details Defined in Crypto.Hash.RIPEMD160 type HashBlockSize RIPEMD160 = 64
type HashDigestSize RIPEMD160 |
Instance details Defined in Crypto.Hash.RIPEMD160 type HashDigestSize RIPEMD160 = 20
type HashInternalContextSize RIPEMD160 |
Instance details Defined in Crypto.Hash.RIPEMD160 type HashInternalContextSize RIPEMD160 = 128
Methods hashBlockSize :: RIPEMD160 -> Int # hashDigestSize :: RIPEMD160 -> Int # hashInternalContextSize :: RIPEMD160 -> Int # hashInternalInit :: Ptr (Context RIPEMD160) -> IO () # hashInternalUpdate :: Ptr (Context RIPEMD160) -> Ptr Word8 -> Word32 -> IO () # hashInternalFinalize :: Ptr (Context RIPEMD160) -> Ptr (Digest RIPEMD160) -> IO () #
HashAlgorithm SHA1 # |
Instance details Defined in Crypto.Hash.SHA1 Associated Types
type HashBlockSize SHA1 |
Instance details Defined in Crypto.Hash.SHA1 type HashBlockSize SHA1 = 64
type HashDigestSize SHA1 |
Instance details Defined in Crypto.Hash.SHA1 type HashDigestSize SHA1 = 20
type HashInternalContextSize SHA1 |
Instance details Defined in Crypto.Hash.SHA1 type HashInternalContextSize SHA1 = 96
Methods hashBlockSize :: SHA1 -> Int # hashDigestSize :: SHA1 -> Int # hashInternalContextSize :: SHA1 -> Int # hashInternalInit :: Ptr (Context SHA1) -> IO () # hashInternalUpdate :: Ptr (Context SHA1) -> Ptr Word8 -> Word32 -> IO () # hashInternalFinalize :: Ptr (Context SHA1) -> Ptr (Digest SHA1) -> IO () #
HashAlgorithm SHA224 # |
Instance details Defined in Crypto.Hash.SHA224 Associated Types
type HashBlockSize SHA224 |
Instance details Defined in Crypto.Hash.SHA224 type HashBlockSize SHA224 = 64
type HashDigestSize SHA224 |
Instance details Defined in Crypto.Hash.SHA224 type HashDigestSize SHA224 = 28
type HashInternalContextSize SHA224 |
Instance details Defined in Crypto.Hash.SHA224 type HashInternalContextSize SHA224 = 192
Methods hashBlockSize :: SHA224 -> Int # hashDigestSize :: SHA224 -> Int # hashInternalContextSize :: SHA224 -> Int # hashInternalInit :: Ptr (Context SHA224) -> IO () # hashInternalUpdate :: Ptr (Context SHA224) -> Ptr Word8 -> Word32 -> IO () # hashInternalFinalize :: Ptr (Context SHA224) -> Ptr (Digest SHA224) -> IO () #
HashAlgorithm SHA256 # |
Instance details Defined in Crypto.Hash.SHA256 Associated Types
type HashBlockSize SHA256 |
Instance details Defined in Crypto.Hash.SHA256 type HashBlockSize SHA256 = 64
type HashDigestSize SHA256 |
Instance details Defined in Crypto.Hash.SHA256 type HashDigestSize SHA256 = 32
type HashInternalContextSize SHA256 |
Instance details Defined in Crypto.Hash.SHA256 type HashInternalContextSize SHA256 = 192
Methods hashBlockSize :: SHA256 -> Int # hashDigestSize :: SHA256 -> Int # hashInternalContextSize :: SHA256 -> Int # hashInternalInit :: Ptr (Context SHA256) -> IO () # hashInternalUpdate :: Ptr (Context SHA256) -> Ptr Word8 -> Word32 -> IO () # hashInternalFinalize :: Ptr (Context SHA256) -> Ptr (Digest SHA256) -> IO () #
HashAlgorithm SHA3_224 # |
Instance details Defined in Crypto.Hash.SHA3 Associated Types
type HashBlockSize SHA3_224 |
Instance details Defined in Crypto.Hash.SHA3 type HashBlockSize SHA3_224 = 144
type HashDigestSize SHA3_224 |
Instance details Defined in Crypto.Hash.SHA3 type HashDigestSize SHA3_224 = 28
type HashInternalContextSize SHA3_224 |
Instance details Defined in Crypto.Hash.SHA3 type HashInternalContextSize SHA3_224 = 352
Methods hashBlockSize :: SHA3_224 -> Int # hashDigestSize :: SHA3_224 -> Int # hashInternalContextSize :: SHA3_224 -> Int # hashInternalInit :: Ptr (Context SHA3_224) -> IO () # hashInternalUpdate :: Ptr (Context SHA3_224) -> Ptr Word8 -> Word32 -> IO () # hashInternalFinalize :: Ptr (Context SHA3_224) -> Ptr (Digest SHA3_224) -> IO () #
HashAlgorithm SHA3_256 # |
Instance details Defined in Crypto.Hash.SHA3 Associated Types
type HashBlockSize SHA3_256 |
Instance details Defined in Crypto.Hash.SHA3 type HashBlockSize SHA3_256 = 136
type HashDigestSize SHA3_256 |
Instance details Defined in Crypto.Hash.SHA3 type HashDigestSize SHA3_256 = 32
type HashInternalContextSize SHA3_256 |
Instance details Defined in Crypto.Hash.SHA3 type HashInternalContextSize SHA3_256 = 344
Methods hashBlockSize :: SHA3_256 -> Int # hashDigestSize :: SHA3_256 -> Int # hashInternalContextSize :: SHA3_256 -> Int # hashInternalInit :: Ptr (Context SHA3_256) -> IO () # hashInternalUpdate :: Ptr (Context SHA3_256) -> Ptr Word8 -> Word32 -> IO () # hashInternalFinalize :: Ptr (Context SHA3_256) -> Ptr (Digest SHA3_256) -> IO () #
HashAlgorithm SHA3_384 # |
Instance details Defined in Crypto.Hash.SHA3 Associated Types
type HashBlockSize SHA3_384 |
Instance details Defined in Crypto.Hash.SHA3 type HashBlockSize SHA3_384 = 104
type HashDigestSize SHA3_384 |
Instance details Defined in Crypto.Hash.SHA3 type HashDigestSize SHA3_384 = 48
type HashInternalContextSize SHA3_384 |
Instance details Defined in Crypto.Hash.SHA3 type HashInternalContextSize SHA3_384 = 312
Methods hashBlockSize :: SHA3_384 -> Int # hashDigestSize :: SHA3_384 -> Int # hashInternalContextSize :: SHA3_384 -> Int # hashInternalInit :: Ptr (Context SHA3_384) -> IO () # hashInternalUpdate :: Ptr (Context SHA3_384) -> Ptr Word8 -> Word32 -> IO () # hashInternalFinalize :: Ptr (Context SHA3_384) -> Ptr (Digest SHA3_384) -> IO () #
HashAlgorithm SHA3_512 # |
Instance details Defined in Crypto.Hash.SHA3 Associated Types
type HashBlockSize SHA3_512 |
Instance details Defined in Crypto.Hash.SHA3 type HashBlockSize SHA3_512 = 72
type HashDigestSize SHA3_512 |
Instance details Defined in Crypto.Hash.SHA3 type HashDigestSize SHA3_512 = 64
type HashInternalContextSize SHA3_512 |
Instance details Defined in Crypto.Hash.SHA3 type HashInternalContextSize SHA3_512 = 280
Methods hashBlockSize :: SHA3_512 -> Int # hashDigestSize :: SHA3_512 -> Int # hashInternalContextSize :: SHA3_512 -> Int # hashInternalInit :: Ptr (Context SHA3_512) -> IO () # hashInternalUpdate :: Ptr (Context SHA3_512) -> Ptr Word8 -> Word32 -> IO () # hashInternalFinalize :: Ptr (Context SHA3_512) -> Ptr (Digest SHA3_512) -> IO () #
HashAlgorithm SHA384 # |
Instance details Defined in Crypto.Hash.SHA384 Associated Types
type HashBlockSize SHA384 |
Instance details Defined in Crypto.Hash.SHA384 type HashBlockSize SHA384 = 128
type HashDigestSize SHA384 |
Instance details Defined in Crypto.Hash.SHA384 type HashDigestSize SHA384 = 48
type HashInternalContextSize SHA384 |
Instance details Defined in Crypto.Hash.SHA384 type HashInternalContextSize SHA384 = 256
Methods hashBlockSize :: SHA384 -> Int # hashDigestSize :: SHA384 -> Int # hashInternalContextSize :: SHA384 -> Int # hashInternalInit :: Ptr (Context SHA384) -> IO () # hashInternalUpdate :: Ptr (Context SHA384) -> Ptr Word8 -> Word32 -> IO () # hashInternalFinalize :: Ptr (Context SHA384) -> Ptr (Digest SHA384) -> IO () #
HashAlgorithm SHA512 # |
Instance details Defined in Crypto.Hash.SHA512 Associated Types
type HashBlockSize SHA512 |
Instance details Defined in Crypto.Hash.SHA512 type HashBlockSize SHA512 = 128
type HashDigestSize SHA512 |
Instance details Defined in Crypto.Hash.SHA512 type HashDigestSize SHA512 = 64
type HashInternalContextSize SHA512 |
Instance details Defined in Crypto.Hash.SHA512 type HashInternalContextSize SHA512 = 256
Methods hashBlockSize :: SHA512 -> Int # hashDigestSize :: SHA512 -> Int # hashInternalContextSize :: SHA512 -> Int # hashInternalInit :: Ptr (Context SHA512) -> IO () # hashInternalUpdate :: Ptr (Context SHA512) -> Ptr Word8 -> Word32 -> IO () # hashInternalFinalize :: Ptr (Context SHA512) -> Ptr (Digest SHA512) -> IO () #
HashAlgorithm SHA512t_224 # |
Instance details Defined in Crypto.Hash.SHA512t Associated Types
type HashBlockSize SHA512t_224 |
Instance details Defined in Crypto.Hash.SHA512t type HashBlockSize SHA512t_224 = 128
type HashDigestSize SHA512t_224 |
Instance details Defined in Crypto.Hash.SHA512t type HashDigestSize SHA512t_224 = 28
type HashInternalContextSize SHA512t_224 |
Instance details Defined in Crypto.Hash.SHA512t type HashInternalContextSize SHA512t_224 = 256
Methods hashBlockSize :: SHA512t_224 -> Int # hashDigestSize :: SHA512t_224 -> Int # hashInternalContextSize :: SHA512t_224 -> Int # hashInternalInit :: Ptr (Context SHA512t_224) -> IO () # hashInternalUpdate :: Ptr (Context SHA512t_224) -> Ptr Word8 -> Word32 -> IO () # hashInternalFinalize :: Ptr (Context SHA512t_224) -> Ptr (Digest SHA512t_224) -> IO () #
HashAlgorithm SHA512t_256 # |
Instance details Defined in Crypto.Hash.SHA512t Associated Types
type HashBlockSize SHA512t_256 |
Instance details Defined in Crypto.Hash.SHA512t type HashBlockSize SHA512t_256 = 128
type HashDigestSize SHA512t_256 |
Instance details Defined in Crypto.Hash.SHA512t type HashDigestSize SHA512t_256 = 32
type HashInternalContextSize SHA512t_256 |
Instance details Defined in Crypto.Hash.SHA512t type HashInternalContextSize SHA512t_256 = 256
Methods hashBlockSize :: SHA512t_256 -> Int # hashDigestSize :: SHA512t_256 -> Int # hashInternalContextSize :: SHA512t_256 -> Int # hashInternalInit :: Ptr (Context SHA512t_256) -> IO () # hashInternalUpdate :: Ptr (Context SHA512t_256) -> Ptr Word8 -> Word32 -> IO () # hashInternalFinalize :: Ptr (Context SHA512t_256) -> Ptr (Digest SHA512t_256) -> IO () #
HashAlgorithm Skein256_224 # |
Instance details Defined in Crypto.Hash.Skein256 Associated Types
type HashBlockSize Skein256_224 |
Instance details Defined in Crypto.Hash.Skein256 type HashBlockSize Skein256_224 = 32
type HashDigestSize Skein256_224 |
Instance details Defined in Crypto.Hash.Skein256 type HashDigestSize Skein256_224 = 28
type HashInternalContextSize Skein256_224 |
Instance details Defined in Crypto.Hash.Skein256 type HashInternalContextSize Skein256_224 = 96
Methods hashBlockSize :: Skein256_224 -> Int # hashDigestSize :: Skein256_224 -> Int # hashInternalContextSize :: Skein256_224 -> Int # hashInternalInit :: Ptr (Context Skein256_224) -> IO () # hashInternalUpdate :: Ptr (Context Skein256_224) -> Ptr Word8 -> Word32 -> IO () # hashInternalFinalize :: Ptr (Context Skein256_224) -> Ptr (Digest Skein256_224) -> IO () #
HashAlgorithm Skein256_256 # |
Instance details Defined in Crypto.Hash.Skein256 Associated Types
type HashBlockSize Skein256_256 |
Instance details Defined in Crypto.Hash.Skein256 type HashBlockSize Skein256_256 = 32
type HashDigestSize Skein256_256 |
Instance details Defined in Crypto.Hash.Skein256 type HashDigestSize Skein256_256 = 32
type HashInternalContextSize Skein256_256 |
Instance details Defined in Crypto.Hash.Skein256 type HashInternalContextSize Skein256_256 = 96
Methods hashBlockSize :: Skein256_256 -> Int # hashDigestSize :: Skein256_256 -> Int # hashInternalContextSize :: Skein256_256 -> Int # hashInternalInit :: Ptr (Context Skein256_256) -> IO () # hashInternalUpdate :: Ptr (Context Skein256_256) -> Ptr Word8 -> Word32 -> IO () # hashInternalFinalize :: Ptr (Context Skein256_256) -> Ptr (Digest Skein256_256) -> IO () #
HashAlgorithm Skein512_224 # |
Instance details Defined in Crypto.Hash.Skein512 Associated Types
type HashBlockSize Skein512_224 |
Instance details Defined in Crypto.Hash.Skein512 type HashBlockSize Skein512_224 = 64
type HashDigestSize Skein512_224 |
Instance details Defined in Crypto.Hash.Skein512 type HashDigestSize Skein512_224 = 28
type HashInternalContextSize Skein512_224 |
Instance details Defined in Crypto.Hash.Skein512 type HashInternalContextSize Skein512_224 = 160
Methods hashBlockSize :: Skein512_224 -> Int # hashDigestSize :: Skein512_224 -> Int # hashInternalContextSize :: Skein512_224 -> Int # hashInternalInit :: Ptr (Context Skein512_224) -> IO () # hashInternalUpdate :: Ptr (Context Skein512_224) -> Ptr Word8 -> Word32 -> IO () # hashInternalFinalize :: Ptr (Context Skein512_224) -> Ptr (Digest Skein512_224) -> IO () #
HashAlgorithm Skein512_256 # |
Instance details Defined in Crypto.Hash.Skein512 Associated Types
type HashBlockSize Skein512_256 |
Instance details Defined in Crypto.Hash.Skein512 type HashBlockSize Skein512_256 = 64
type HashDigestSize Skein512_256 |
Instance details Defined in Crypto.Hash.Skein512 type HashDigestSize Skein512_256 = 32
type HashInternalContextSize Skein512_256 |
Instance details Defined in Crypto.Hash.Skein512 type HashInternalContextSize Skein512_256 = 160
Methods hashBlockSize :: Skein512_256 -> Int # hashDigestSize :: Skein512_256 -> Int # hashInternalContextSize :: Skein512_256 -> Int # hashInternalInit :: Ptr (Context Skein512_256) -> IO () # hashInternalUpdate :: Ptr (Context Skein512_256) -> Ptr Word8 -> Word32 -> IO () # hashInternalFinalize :: Ptr (Context Skein512_256) -> Ptr (Digest Skein512_256) -> IO () #
HashAlgorithm Skein512_384 # |
Instance details Defined in Crypto.Hash.Skein512 Associated Types
type HashBlockSize Skein512_384 |
Instance details Defined in Crypto.Hash.Skein512 type HashBlockSize Skein512_384 = 64
type HashDigestSize Skein512_384 |
Instance details Defined in Crypto.Hash.Skein512 type HashDigestSize Skein512_384 = 48
type HashInternalContextSize Skein512_384 |
Instance details Defined in Crypto.Hash.Skein512 type HashInternalContextSize Skein512_384 = 160
Methods hashBlockSize :: Skein512_384 -> Int # hashDigestSize :: Skein512_384 -> Int # hashInternalContextSize :: Skein512_384 -> Int # hashInternalInit :: Ptr (Context Skein512_384) -> IO () # hashInternalUpdate :: Ptr (Context Skein512_384) -> Ptr Word8 -> Word32 -> IO () # hashInternalFinalize :: Ptr (Context Skein512_384) -> Ptr (Digest Skein512_384) -> IO () #
HashAlgorithm Skein512_512 # |
Instance details Defined in Crypto.Hash.Skein512 Associated Types
type HashBlockSize Skein512_512 |
Instance details Defined in Crypto.Hash.Skein512 type HashBlockSize Skein512_512 = 64
type HashDigestSize Skein512_512 |
Instance details Defined in Crypto.Hash.Skein512 type HashDigestSize Skein512_512 = 64
type HashInternalContextSize Skein512_512 |
Instance details Defined in Crypto.Hash.Skein512 type HashInternalContextSize Skein512_512 = 160
Methods hashBlockSize :: Skein512_512 -> Int # hashDigestSize :: Skein512_512 -> Int # hashInternalContextSize :: Skein512_512 -> Int # hashInternalInit :: Ptr (Context Skein512_512) -> IO () # hashInternalUpdate :: Ptr (Context Skein512_512) -> Ptr Word8 -> Word32 -> IO () # hashInternalFinalize :: Ptr (Context Skein512_512) -> Ptr (Digest Skein512_512) -> IO () #
HashAlgorithm Tiger # |
Instance details Defined in Crypto.Hash.Tiger Associated Types
type HashBlockSize Tiger |
Instance details Defined in Crypto.Hash.Tiger type HashBlockSize Tiger = 64
type HashDigestSize Tiger |
Instance details Defined in Crypto.Hash.Tiger type HashDigestSize Tiger = 24
type HashInternalContextSize Tiger |
Instance details Defined in Crypto.Hash.Tiger type HashInternalContextSize Tiger = 96
Methods hashBlockSize :: Tiger -> Int # hashDigestSize :: Tiger -> Int # hashInternalContextSize :: Tiger -> Int # hashInternalInit :: Ptr (Context Tiger) -> IO () # hashInternalUpdate :: Ptr (Context Tiger) -> Ptr Word8 -> Word32 -> IO () # hashInternalFinalize :: Ptr (Context Tiger) -> Ptr (Digest Tiger) -> IO () #
HashAlgorithm Whirlpool # |
Instance details Defined in Crypto.Hash.Whirlpool Associated Types
type HashBlockSize Whirlpool |
Instance details Defined in Crypto.Hash.Whirlpool type HashBlockSize Whirlpool = 64
type HashDigestSize Whirlpool |
Instance details Defined in Crypto.Hash.Whirlpool type HashDigestSize Whirlpool = 64
type HashInternalContextSize Whirlpool |
Instance details Defined in Crypto.Hash.Whirlpool type HashInternalContextSize Whirlpool = 168
Methods hashBlockSize :: Whirlpool -> Int # hashDigestSize :: Whirlpool -> Int # hashInternalContextSize :: Whirlpool -> Int # hashInternalInit :: Ptr (Context Whirlpool) -> IO () # hashInternalUpdate :: Ptr (Context Whirlpool) -> Ptr Word8 -> Word32 -> IO () # hashInternalFinalize :: Ptr (Context Whirlpool) -> Ptr (Digest Whirlpool) -> IO () #
(IsDivisibleBy8 bitlen, KnownNat bitlen, IsAtLeast bitlen 8, IsAtMost bitlen 512) => HashAlgorithm (Blake2b bitlen) # |
Instance details Defined in Crypto.Hash.Blake2 Associated Types
type HashBlockSize (Blake2b bitlen) |
Instance details Defined in Crypto.Hash.Blake2 type HashBlockSize (Blake2b bitlen) = 128
type HashDigestSize (Blake2b bitlen) |
Instance details Defined in Crypto.Hash.Blake2 type HashDigestSize (Blake2b bitlen)
type HashInternalContextSize (Blake2b bitlen) |
Instance details Defined in Crypto.Hash.Blake2 type HashInternalContextSize (Blake2b bitlen) = 248
Methods hashBlockSize :: Blake2b bitlen -> Int # hashDigestSize :: Blake2b bitlen -> Int # hashInternalContextSize :: Blake2b bitlen -> Int # hashInternalInit :: Ptr (Context (Blake2b bitlen)) -> IO () # hashInternalUpdate :: Ptr (Context (Blake2b bitlen)) -> Ptr Word8 -> Word32 -> IO () # hashInternalFinalize :: Ptr (Context (Blake2b bitlen)) -> Ptr (Digest (Blake2b bitlen)) -> IO () #
(IsDivisibleBy8 bitlen, KnownNat bitlen, IsAtLeast bitlen 8, IsAtMost bitlen 512) => HashAlgorithm (Blake2bp bitlen) # |
Instance details Defined in Crypto.Hash.Blake2 Associated Types
type HashBlockSize (Blake2bp bitlen) |
Instance details Defined in Crypto.Hash.Blake2 type HashBlockSize (Blake2bp bitlen) = 128
type HashDigestSize (Blake2bp bitlen) |
Instance details Defined in Crypto.Hash.Blake2 type HashDigestSize (Blake2bp bitlen)
type HashInternalContextSize (Blake2bp bitlen) |
Instance details Defined in Crypto.Hash.Blake2 type HashInternalContextSize (Blake2bp bitlen) = 2325
Methods hashBlockSize :: Blake2bp bitlen -> Int # hashDigestSize :: Blake2bp bitlen -> Int # hashInternalContextSize :: Blake2bp bitlen -> Int # hashInternalInit :: Ptr (Context (Blake2bp bitlen)) -> IO () # hashInternalUpdate :: Ptr (Context (Blake2bp bitlen)) -> Ptr Word8 -> Word32 -> IO () # hashInternalFinalize :: Ptr (Context (Blake2bp bitlen)) -> Ptr (Digest (Blake2bp bitlen)) -> IO () #
(IsDivisibleBy8 bitlen, KnownNat bitlen, IsAtLeast bitlen 8, IsAtMost bitlen 256) => HashAlgorithm (Blake2s bitlen) # |
Instance details Defined in Crypto.Hash.Blake2 Associated Types
type HashBlockSize (Blake2s bitlen) |
Instance details Defined in Crypto.Hash.Blake2 type HashBlockSize (Blake2s bitlen) = 64
type HashDigestSize (Blake2s bitlen) |
Instance details Defined in Crypto.Hash.Blake2 type HashDigestSize (Blake2s bitlen)
type HashInternalContextSize (Blake2s bitlen) |
Instance details Defined in Crypto.Hash.Blake2 type HashInternalContextSize (Blake2s bitlen) = 136
Methods hashBlockSize :: Blake2s bitlen -> Int # hashDigestSize :: Blake2s bitlen -> Int # hashInternalContextSize :: Blake2s bitlen -> Int # hashInternalInit :: Ptr (Context (Blake2s bitlen)) -> IO () # hashInternalUpdate :: Ptr (Context (Blake2s bitlen)) -> Ptr Word8 -> Word32 -> IO () # hashInternalFinalize :: Ptr (Context (Blake2s bitlen)) -> Ptr (Digest (Blake2s bitlen)) -> IO () #
(IsDivisibleBy8 bitlen, KnownNat bitlen, IsAtLeast bitlen 8, IsAtMost bitlen 256) => HashAlgorithm (Blake2sp bitlen) # |
Instance details Defined in Crypto.Hash.Blake2 Associated Types
type HashBlockSize (Blake2sp bitlen) |
Instance details Defined in Crypto.Hash.Blake2 type HashBlockSize (Blake2sp bitlen) = 64
type HashDigestSize (Blake2sp bitlen) |
Instance details Defined in Crypto.Hash.Blake2 type HashDigestSize (Blake2sp bitlen)
type HashInternalContextSize (Blake2sp bitlen) |
Instance details Defined in Crypto.Hash.Blake2 type HashInternalContextSize (Blake2sp bitlen) = 2185
Methods hashBlockSize :: Blake2sp bitlen -> Int # hashDigestSize :: Blake2sp bitlen -> Int # hashInternalContextSize :: Blake2sp bitlen -> Int # hashInternalInit :: Ptr (Context (Blake2sp bitlen)) -> IO () # hashInternalUpdate :: Ptr (Context (Blake2sp bitlen)) -> Ptr Word8 -> Word32 -> IO () # hashInternalFinalize :: Ptr (Context (Blake2sp bitlen)) -> Ptr (Digest (Blake2sp bitlen)) -> IO () #
KnownNat bitlen => HashAlgorithm (SHAKE128 bitlen) # |
Instance details Defined in Crypto.Hash.SHAKE Associated Types
type HashBlockSize (SHAKE128 bitlen) |
Instance details Defined in Crypto.Hash.SHAKE type HashBlockSize (SHAKE128 bitlen) = 168
type HashDigestSize (SHAKE128 bitlen) |
Instance details Defined in Crypto.Hash.SHAKE type HashDigestSize (SHAKE128 bitlen)
type HashInternalContextSize (SHAKE128 bitlen) |
Instance details Defined in Crypto.Hash.SHAKE type HashInternalContextSize (SHAKE128 bitlen) = 376
Methods hashBlockSize :: SHAKE128 bitlen -> Int # hashDigestSize :: SHAKE128 bitlen -> Int # hashInternalContextSize :: SHAKE128 bitlen -> Int # hashInternalInit :: Ptr (Context (SHAKE128 bitlen)) -> IO () # hashInternalUpdate :: Ptr (Context (SHAKE128 bitlen)) -> Ptr Word8 -> Word32 -> IO () # hashInternalFinalize :: Ptr (Context (SHAKE128 bitlen)) -> Ptr (Digest (SHAKE128 bitlen)) -> IO () #
KnownNat bitlen => HashAlgorithm (SHAKE256 bitlen) # |
Instance details Defined in Crypto.Hash.SHAKE Associated Types
type HashBlockSize (SHAKE256 bitlen) |
Instance details Defined in Crypto.Hash.SHAKE type HashBlockSize (SHAKE256 bitlen) = 136
type HashDigestSize (SHAKE256 bitlen) |
Instance details Defined in Crypto.Hash.SHAKE type HashDigestSize (SHAKE256 bitlen)
type HashInternalContextSize (SHAKE256 bitlen) |
Instance details Defined in Crypto.Hash.SHAKE type HashInternalContextSize (SHAKE256 bitlen) = 344
Methods hashBlockSize :: SHAKE256 bitlen -> Int # hashDigestSize :: SHAKE256 bitlen -> Int # hashInternalContextSize :: SHAKE256 bitlen -> Int # hashInternalInit :: Ptr (Context (SHAKE256 bitlen)) -> IO () # hashInternalUpdate :: Ptr (Context (SHAKE256 bitlen)) -> Ptr Word8 -> Word32 -> IO () # hashInternalFinalize :: Ptr (Context (SHAKE256 bitlen)) -> Ptr (Digest (SHAKE256 bitlen)) -> IO () #

data MutableContext a #

A Mutable hash context

This type is an instance of `ByteArrayAccess` for debugging purpose. Internal layout is architecture dependent, may contain uninitialized data fragments, and change in future versions. The bytearray should not be used as input to cryptographic algorithms.

#### Instances

Instances details

ByteArrayAccess (MutableContext a) # |
Instance details Defined in Crypto.Hash.IO Methods length :: MutableContext a -> Int # withByteArray :: MutableContext a -> (Ptr p -> IO a0) -> IO a0 # copyByteArrayToPtr :: MutableContext a -> Ptr p -> IO () #

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

Create a new mutable hash context.

the algorithm used is automatically determined from the return constraint.

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

Create a new mutable hash context.

The algorithm is explicitely passed as parameter

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

Update a mutable hash context in place

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

Finalize a mutable hash context and compute a digest

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

Reset the mutable context to the initial state of the hash