cryptonite-0.24: Cryptography Primitives sink

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

Crypto.Hash.Algorithms

Contents

- hash algorithms

Description

Definitions of known hash algorithms

Synopsis

- class HashAlgorithm a
- data Blake2s_160 = Blake2s_160
- data Blake2s_224 = Blake2s_224
- data Blake2s_256 = Blake2s_256
- data Blake2sp_224 = Blake2sp_224
- data Blake2sp_256 = Blake2sp_256
- data Blake2b_160 = Blake2b_160
- data Blake2b_224 = Blake2b_224
- data Blake2b_256 = Blake2b_256
- data Blake2b_384 = Blake2b_384
- data Blake2b_512 = Blake2b_512
- data Blake2bp_512 = Blake2bp_512
- data MD2 = MD2
- data MD4 = MD4
- data MD5 = MD5
- data SHA1 = SHA1
- data SHA224 = SHA224
- data SHA256 = SHA256
- data SHA384 = SHA384
- data SHA512 = SHA512
- data SHA512t_224 = SHA512t_224
- data SHA512t_256 = SHA512t_256
- data RIPEMD160 = RIPEMD160
- data Tiger = Tiger
- data Keccak_224 = Keccak_224
- data Keccak_256 = Keccak_256
- data Keccak_384 = Keccak_384
- data Keccak_512 = Keccak_512
- data SHA3_224 = SHA3_224
- data SHA3_256 = SHA3_256
- data SHA3_384 = SHA3_384
- data SHA3_512 = SHA3_512
- data SHAKE128 bitlen = SHAKE128
- data SHAKE256 bitlen = SHAKE256
- data Blake2b bitlen = Blake2b
- data Blake2bp bitlen = Blake2bp
- data Blake2s bitlen = Blake2s
- data Blake2sp bitlen = Blake2sp
- data Skein256_224 = Skein256_224
- data Skein256_256 = Skein256_256
- data Skein512_224 = Skein512_224
- data Skein512_256 = Skein512_256
- data Skein512_384 = Skein512_384
- data Skein512_512 = Skein512_512
- data Whirlpool = Whirlpool

# Documentation

class HashAlgorithm a

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

Instances

HashAlgorithm Blake2s_256 |
HashAlgorithm Blake2s_224 |
HashAlgorithm Blake2s_160 |
HashAlgorithm Blake2sp_256 |
HashAlgorithm Blake2sp_224 |
HashAlgorithm Blake2b_512 |
HashAlgorithm Blake2b_384 |
HashAlgorithm Blake2b_256 |
HashAlgorithm Blake2b_224 |
HashAlgorithm Blake2b_160 |
HashAlgorithm Blake2bp_512 |
HashAlgorithm MD2 |
HashAlgorithm MD4 |
HashAlgorithm MD5 |
HashAlgorithm SHA1 |
HashAlgorithm SHA224 |
HashAlgorithm SHA256 |
HashAlgorithm SHA384 |
HashAlgorithm SHA512 |
HashAlgorithm SHA512t_256 |
HashAlgorithm SHA512t_224 |
HashAlgorithm SHA3_512 |
HashAlgorithm SHA3_384 |
HashAlgorithm SHA3_256 |
HashAlgorithm SHA3_224 |
HashAlgorithm Keccak_512 |
HashAlgorithm Keccak_384 |
HashAlgorithm Keccak_256 |
HashAlgorithm Keccak_224 |
HashAlgorithm RIPEMD160 |
HashAlgorithm Tiger |
HashAlgorithm Skein256_256 |
HashAlgorithm Skein256_224 |
HashAlgorithm Skein512_512 |
HashAlgorithm Skein512_384 |
HashAlgorithm Skein512_256 |
HashAlgorithm Skein512_224 |
HashAlgorithm Whirlpool |
(IsDivisibleBy8 bitlen, KnownNat bitlen) => HashAlgorithm (SHAKE256 bitlen) |
(IsDivisibleBy8 bitlen, KnownNat bitlen) => HashAlgorithm (SHAKE128 bitlen) |
(IsDivisibleBy8 bitlen, KnownNat bitlen, IsAtLeast bitlen 8, IsAtMost bitlen 512) => HashAlgorithm (Blake2bp bitlen) |
(IsDivisibleBy8 bitlen, KnownNat bitlen, IsAtLeast bitlen 8, IsAtMost bitlen 256) => HashAlgorithm (Blake2sp bitlen) |
(IsDivisibleBy8 bitlen, KnownNat bitlen, IsAtLeast bitlen 8, IsAtMost bitlen 512) => HashAlgorithm (Blake2b bitlen) |
(IsDivisibleBy8 bitlen, KnownNat bitlen, IsAtLeast bitlen 8, IsAtMost bitlen 256) => HashAlgorithm (Blake2s bitlen) |

# hash algorithms

data Blake2s_160

Blake2s (160 bits) cryptographic hash algorithm

Constructors

Blake2s_160 |

Instances

Data Blake2s_160 |
Show Blake2s_160 |
HashAlgorithm Blake2s_160 |
type HashBlockSize Blake2s_160 = 64 |
type HashDigestSize Blake2s_160 = 20 |
type HashInternalContextSize Blake2s_160 = 185 |

data Blake2s_224

Blake2s (224 bits) cryptographic hash algorithm

Constructors

Blake2s_224 |

Instances

Data Blake2s_224 |
Show Blake2s_224 |
HashAlgorithm Blake2s_224 |
type HashBlockSize Blake2s_224 = 64 |
type HashDigestSize Blake2s_224 = 28 |
type HashInternalContextSize Blake2s_224 = 185 |

data Blake2s_256

Blake2s (256 bits) cryptographic hash algorithm

Constructors

Blake2s_256 |

Instances

Data Blake2s_256 |
Show Blake2s_256 |
HashAlgorithm Blake2s_256 |
type HashBlockSize Blake2s_256 = 64 |
type HashDigestSize Blake2s_256 = 32 |
type HashInternalContextSize Blake2s_256 = 185 |

data Blake2sp_224

Blake2sp (224 bits) cryptographic hash algorithm

Constructors

Blake2sp_224 |

Instances

Data Blake2sp_224 |
Show Blake2sp_224 |
HashAlgorithm Blake2sp_224 |
type HashBlockSize Blake2sp_224 = 64 |
type HashDigestSize Blake2sp_224 = 28 |
type HashInternalContextSize Blake2sp_224 = 2185 |

data Blake2sp_256

Blake2sp (256 bits) cryptographic hash algorithm

Constructors

Blake2sp_256 |

Instances

Data Blake2sp_256 |
Show Blake2sp_256 |
HashAlgorithm Blake2sp_256 |
type HashBlockSize Blake2sp_256 = 64 |
type HashDigestSize Blake2sp_256 = 32 |
type HashInternalContextSize Blake2sp_256 = 2185 |

data Blake2b_160

Blake2b (160 bits) cryptographic hash algorithm

Constructors

Blake2b_160 |

Instances

Data Blake2b_160 |
Show Blake2b_160 |
HashAlgorithm Blake2b_160 |
type HashBlockSize Blake2b_160 = 128 |
type HashDigestSize Blake2b_160 = 20 |
type HashInternalContextSize Blake2b_160 = 361 |

data Blake2b_224

Blake2b (224 bits) cryptographic hash algorithm

Constructors

Blake2b_224 |

Instances

Data Blake2b_224 |
Show Blake2b_224 |
HashAlgorithm Blake2b_224 |
type HashBlockSize Blake2b_224 = 128 |
type HashDigestSize Blake2b_224 = 28 |
type HashInternalContextSize Blake2b_224 = 361 |

data Blake2b_256

Blake2b (256 bits) cryptographic hash algorithm

Constructors

Blake2b_256 |

Instances

Data Blake2b_256 |
Show Blake2b_256 |
HashAlgorithm Blake2b_256 |
type HashBlockSize Blake2b_256 = 128 |
type HashDigestSize Blake2b_256 = 32 |
type HashInternalContextSize Blake2b_256 = 361 |

data Blake2b_384

Blake2b (384 bits) cryptographic hash algorithm

Constructors

Blake2b_384 |

Instances

Data Blake2b_384 |
Show Blake2b_384 |
HashAlgorithm Blake2b_384 |
type HashBlockSize Blake2b_384 = 128 |
type HashDigestSize Blake2b_384 = 48 |
type HashInternalContextSize Blake2b_384 = 361 |

data Blake2b_512

Blake2b (512 bits) cryptographic hash algorithm

Constructors

Blake2b_512 |

Instances

Data Blake2b_512 |
Show Blake2b_512 |
HashAlgorithm Blake2b_512 |
type HashBlockSize Blake2b_512 = 128 |
type HashDigestSize Blake2b_512 = 64 |
type HashInternalContextSize Blake2b_512 = 361 |

data Blake2bp_512

Blake2bp (512 bits) cryptographic hash algorithm

Constructors

Blake2bp_512 |

Instances

Data Blake2bp_512 |
Show Blake2bp_512 |
HashAlgorithm Blake2bp_512 |
type HashBlockSize Blake2bp_512 = 128 |
type HashDigestSize Blake2bp_512 = 64 |
type HashInternalContextSize Blake2bp_512 = 2325 |

data MD2

MD2 cryptographic hash algorithm

Constructors

MD2 |

Instances

Data MD2 |
Show MD2 |
HashAlgorithm MD2 |
HashAlgorithmASN1 MD2 |
type HashBlockSize MD2 = 16 |
type HashDigestSize MD2 = 16 |
type HashInternalContextSize MD2 = 96 |

data MD4

MD4 cryptographic hash algorithm

Constructors

MD4 |

Instances

Data MD4 |
Show MD4 |
HashAlgorithm MD4 |
type HashBlockSize MD4 = 64 |
type HashDigestSize MD4 = 16 |
type HashInternalContextSize MD4 = 96 |

data MD5

MD5 cryptographic hash algorithm

Constructors

MD5 |

Instances

Data MD5 |
Show MD5 |
HashAlgorithm MD5 |
HashAlgorithmASN1 MD5 |
type HashBlockSize MD5 = 64 |
type HashDigestSize MD5 = 16 |
type HashInternalContextSize MD5 = 96 |

data SHA1

SHA1 cryptographic hash algorithm

Constructors

SHA1 |

Instances

Data SHA1 |
Show SHA1 |
HashAlgorithm SHA1 |
HashAlgorithmASN1 SHA1 |
type HashBlockSize SHA1 = 64 |
type HashDigestSize SHA1 = 20 |
type HashInternalContextSize SHA1 = 96 |

data SHA224

SHA224 cryptographic hash algorithm

Constructors

SHA224 |

Instances

Data SHA224 |
Show SHA224 |
HashAlgorithm SHA224 |
HashAlgorithmASN1 SHA224 |
type HashBlockSize SHA224 = 64 |
type HashDigestSize SHA224 = 28 |
type HashInternalContextSize SHA224 = 192 |

data SHA256

SHA256 cryptographic hash algorithm

Constructors

SHA256 |

Instances

Data SHA256 |
Show SHA256 |
HashAlgorithm SHA256 |
HashAlgorithmASN1 SHA256 |
type HashBlockSize SHA256 = 64 |
type HashDigestSize SHA256 = 32 |
type HashInternalContextSize SHA256 = 192 |

data SHA384

SHA384 cryptographic hash algorithm

Constructors

SHA384 |

Instances

Data SHA384 |
Show SHA384 |
HashAlgorithm SHA384 |
HashAlgorithmASN1 SHA384 |
type HashBlockSize SHA384 = 128 |
type HashDigestSize SHA384 = 48 |
type HashInternalContextSize SHA384 = 256 |

data SHA512

SHA512 cryptographic hash algorithm

Constructors

SHA512 |

Instances

Data SHA512 |
Show SHA512 |
HashAlgorithm SHA512 |
HashAlgorithmASN1 SHA512 |
type HashBlockSize SHA512 = 128 |
type HashDigestSize SHA512 = 64 |
type HashInternalContextSize SHA512 = 256 |

data SHA512t_224

SHA512t (224 bits) cryptographic hash algorithm

Constructors

SHA512t_224 |

Instances

Data SHA512t_224 |
Show SHA512t_224 |
HashAlgorithm SHA512t_224 |
HashAlgorithmASN1 SHA512t_224 |
type HashBlockSize SHA512t_224 = 128 |
type HashDigestSize SHA512t_224 = 28 |
type HashInternalContextSize SHA512t_224 = 256 |

data SHA512t_256

SHA512t (256 bits) cryptographic hash algorithm

Constructors

SHA512t_256 |

Instances

Data SHA512t_256 |
Show SHA512t_256 |
HashAlgorithm SHA512t_256 |
HashAlgorithmASN1 SHA512t_256 |
type HashBlockSize SHA512t_256 = 128 |
type HashDigestSize SHA512t_256 = 32 |
type HashInternalContextSize SHA512t_256 = 256 |

data RIPEMD160

RIPEMD160 cryptographic hash algorithm

Constructors

RIPEMD160 |

Instances

Data RIPEMD160 |
Show RIPEMD160 |
HashAlgorithm RIPEMD160 |
HashAlgorithmASN1 RIPEMD160 |
type HashBlockSize RIPEMD160 = 64 |
type HashDigestSize RIPEMD160 = 20 |
type HashInternalContextSize RIPEMD160 = 128 |

data Tiger

Tiger cryptographic hash algorithm

Constructors

Tiger |

Instances

Data Tiger |
Show Tiger |
HashAlgorithm Tiger |
type HashBlockSize Tiger = 64 |
type HashDigestSize Tiger = 24 |
type HashInternalContextSize Tiger = 96 |

data Keccak_224

Keccak (224 bits) cryptographic hash algorithm

Constructors

Keccak_224 |

Instances

Data Keccak_224 |
Show Keccak_224 |
HashAlgorithm Keccak_224 |
type HashBlockSize Keccak_224 = 144 |
type HashDigestSize Keccak_224 = 28 |
type HashInternalContextSize Keccak_224 = 352 |

data Keccak_256

Keccak (256 bits) cryptographic hash algorithm

Constructors

Keccak_256 |

Instances

Data Keccak_256 |
Show Keccak_256 |
HashAlgorithm Keccak_256 |
type HashBlockSize Keccak_256 = 136 |
type HashDigestSize Keccak_256 = 32 |
type HashInternalContextSize Keccak_256 = 344 |

data Keccak_384

Keccak (384 bits) cryptographic hash algorithm

Constructors

Keccak_384 |

Instances

Data Keccak_384 |
Show Keccak_384 |
HashAlgorithm Keccak_384 |
type HashBlockSize Keccak_384 = 104 |
type HashDigestSize Keccak_384 = 48 |
type HashInternalContextSize Keccak_384 = 312 |

data Keccak_512

Keccak (512 bits) cryptographic hash algorithm

Constructors

Keccak_512 |

Instances

Data Keccak_512 |
Show Keccak_512 |
HashAlgorithm Keccak_512 |
type HashBlockSize Keccak_512 = 72 |
type HashDigestSize Keccak_512 = 64 |
type HashInternalContextSize Keccak_512 = 280 |

data SHA3_224

SHA3 (224 bits) cryptographic hash algorithm

Constructors

SHA3_224 |

Instances

Data SHA3_224 |
Show SHA3_224 |
HashAlgorithm SHA3_224 |
type HashBlockSize SHA3_224 = 144 |
type HashDigestSize SHA3_224 = 28 |
type HashInternalContextSize SHA3_224 = 352 |

data SHA3_256

SHA3 (256 bits) cryptographic hash algorithm

Constructors

SHA3_256 |

Instances

Data SHA3_256 |
Show SHA3_256 |
HashAlgorithm SHA3_256 |
type HashBlockSize SHA3_256 = 136 |
type HashDigestSize SHA3_256 = 32 |
type HashInternalContextSize SHA3_256 = 344 |

data SHA3_384

SHA3 (384 bits) cryptographic hash algorithm

Constructors

SHA3_384 |

Instances

Data SHA3_384 |
Show SHA3_384 |
HashAlgorithm SHA3_384 |
type HashBlockSize SHA3_384 = 104 |
type HashDigestSize SHA3_384 = 48 |
type HashInternalContextSize SHA3_384 = 312 |

data SHA3_512

SHA3 (512 bits) cryptographic hash algorithm

Constructors

SHA3_512 |

Instances

Data SHA3_512 |
Show SHA3_512 |
HashAlgorithm SHA3_512 |
type HashBlockSize SHA3_512 = 72 |
type HashDigestSize SHA3_512 = 64 |
type HashInternalContextSize SHA3_512 = 280 |

data SHAKE128 bitlen

SHAKE128 (128 bits) extendable output function. Supports an arbitrary digest size (multiple of 8 bits), to be specified as a type parameter of kind `Nat`.

Note: outputs from ``SHAKE128` n` and ``SHAKE128` m` for the same input are correlated (one being a prefix of the other). Results are unrelated to `SHAKE256` results.

Constructors

SHAKE128 |

Instances

Show (SHAKE128 bitlen) |
(IsDivisibleBy8 bitlen, KnownNat bitlen) => HashAlgorithm (SHAKE128 bitlen) |
type HashBlockSize (SHAKE128 bitlen) = 168 |
type HashDigestSize (SHAKE128 bitlen) |
type HashInternalContextSize (SHAKE128 bitlen) = 376 |

data SHAKE256 bitlen

SHAKE256 (256 bits) extendable output function. Supports an arbitrary digest size (multiple of 8 bits), to be specified as a type parameter of kind `Nat`.

Note: outputs from ``SHAKE256` n` and ``SHAKE256` m` for the same input are correlated (one being a prefix of the other). Results are unrelated to `SHAKE128` results.

Constructors

SHAKE256 |

Instances

Show (SHAKE256 bitlen) |
(IsDivisibleBy8 bitlen, KnownNat bitlen) => HashAlgorithm (SHAKE256 bitlen) |
type HashBlockSize (SHAKE256 bitlen) = 136 |
type HashDigestSize (SHAKE256 bitlen) |
type HashInternalContextSize (SHAKE256 bitlen) = 344 |

data Blake2b bitlen

Fast cryptographic hash.

It is especially known to target 64bits architectures.

Known supported digest sizes:

- Blake2b 160
- Blake2b 224
- Blake2b 256
- Blake2b 384
- Blake2b 512

Constructors

Blake2b |

Instances

Show (Blake2b bitlen) |
(IsDivisibleBy8 bitlen, KnownNat bitlen, IsAtLeast bitlen 8, IsAtMost bitlen 512) => HashAlgorithm (Blake2b bitlen) |
type HashBlockSize (Blake2b bitlen) = 128 |
type HashDigestSize (Blake2b bitlen) |
type HashInternalContextSize (Blake2b bitlen) = 361 |

data Blake2bp bitlen

Constructors

Blake2bp |

Instances

Show (Blake2bp bitlen) |
(IsDivisibleBy8 bitlen, KnownNat bitlen, IsAtLeast bitlen 8, IsAtMost bitlen 512) => HashAlgorithm (Blake2bp bitlen) |
type HashBlockSize (Blake2bp bitlen) = 128 |
type HashDigestSize (Blake2bp bitlen) |
type HashInternalContextSize (Blake2bp bitlen) = 2325 |

data Blake2s bitlen

Fast and secure alternative to SHA1 and HMAC-SHA1

It is espacially known to target 32bits architectures.

known supported digest sizes:

- Blake2s 160
- Blake2s 224
- Blake2s 256

Constructors

Blake2s |

Instances

Show (Blake2s bitlen) |
(IsDivisibleBy8 bitlen, KnownNat bitlen, IsAtLeast bitlen 8, IsAtMost bitlen 256) => HashAlgorithm (Blake2s bitlen) |
type HashBlockSize (Blake2s bitlen) = 64 |
type HashDigestSize (Blake2s bitlen) |
type HashInternalContextSize (Blake2s bitlen) = 185 |

data Blake2sp bitlen

Constructors

Blake2sp |

Instances

Show (Blake2sp bitlen) |
(IsDivisibleBy8 bitlen, KnownNat bitlen, IsAtLeast bitlen 8, IsAtMost bitlen 256) => HashAlgorithm (Blake2sp bitlen) |
type HashBlockSize (Blake2sp bitlen) = 64 |
type HashDigestSize (Blake2sp bitlen) |
type HashInternalContextSize (Blake2sp bitlen) = 2185 |

data Skein256_224

Skein256 (224 bits) cryptographic hash algorithm

Constructors

Skein256_224 |

Instances

Data Skein256_224 |
Show Skein256_224 |
HashAlgorithm Skein256_224 |
type HashBlockSize Skein256_224 = 32 |
type HashDigestSize Skein256_224 = 28 |
type HashInternalContextSize Skein256_224 = 96 |

data Skein256_256

Skein256 (256 bits) cryptographic hash algorithm

Constructors

Skein256_256 |

Instances

Data Skein256_256 |
Show Skein256_256 |
HashAlgorithm Skein256_256 |
type HashBlockSize Skein256_256 = 32 |
type HashDigestSize Skein256_256 = 32 |
type HashInternalContextSize Skein256_256 = 96 |

data Skein512_224

Skein512 (224 bits) cryptographic hash algorithm

Constructors

Skein512_224 |

Instances

Data Skein512_224 |
Show Skein512_224 |
HashAlgorithm Skein512_224 |
type HashBlockSize Skein512_224 = 64 |
type HashDigestSize Skein512_224 = 28 |
type HashInternalContextSize Skein512_224 = 160 |

data Skein512_256

Skein512 (256 bits) cryptographic hash algorithm

Constructors

Skein512_256 |

Instances

Data Skein512_256 |
Show Skein512_256 |
HashAlgorithm Skein512_256 |
type HashBlockSize Skein512_256 = 64 |
type HashDigestSize Skein512_256 = 32 |
type HashInternalContextSize Skein512_256 = 160 |

data Skein512_384

Skein512 (384 bits) cryptographic hash algorithm

Constructors

Skein512_384 |

Instances

Data Skein512_384 |
Show Skein512_384 |
HashAlgorithm Skein512_384 |
type HashBlockSize Skein512_384 = 64 |
type HashDigestSize Skein512_384 = 48 |
type HashInternalContextSize Skein512_384 = 160 |

data Skein512_512

Skein512 (512 bits) cryptographic hash algorithm

Constructors

Skein512_512 |

Instances

Data Skein512_512 |
Show Skein512_512 |
HashAlgorithm Skein512_512 |
type HashBlockSize Skein512_512 = 64 |
type HashDigestSize Skein512_512 = 64 |
type HashInternalContextSize Skein512_512 = 160 |

data Whirlpool

Whirlpool cryptographic hash algorithm

Constructors

Whirlpool |

Instances

Data Whirlpool |
Show Whirlpool |
HashAlgorithm Whirlpool |
type HashBlockSize Whirlpool = 64 |
type HashDigestSize Whirlpool = 64 |
type HashInternalContextSize Whirlpool = 168 |