| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Cardano.Crypto.Hashing
Description
Hashing capabilities.
Synopsis
- data AbstractHash algo a
- class HashAlgorithm a
- abstractHash ∷ (HashAlgorithm algo, EncCBOR a) ⇒ a → AbstractHash algo a
- unsafeAbstractHash ∷ HashAlgorithm algo ⇒ LByteString → AbstractHash algo a
- abstractHashFromDigest ∷ Digest algo → AbstractHash algo a
- abstractHashFromBytes ∷ HashAlgorithm algo ⇒ ByteString → Maybe (AbstractHash algo a)
- unsafeAbstractHashFromBytes ∷ ByteString → AbstractHash algo a
- abstractHashToBytes ∷ AbstractHash algo a → ByteString
- unsafeAbstractHashFromShort ∷ ShortByteString → AbstractHash algo a
- abstractHashToShort ∷ AbstractHash algo a → ShortByteString
- decodeAbstractHash ∷ HashAlgorithm algo ⇒ Text → Either Text (AbstractHash algo a)
- type Hash = AbstractHash Blake2b_256
- hashDecoded ∷ Decoded t ⇒ t → Hash (BaseType t)
- hashRaw ∷ ByteString → Hash Raw
- serializeCborHash ∷ EncCBOR a ⇒ a → Hash a
- hashFromBytes ∷ ByteString → Maybe (Hash a)
- unsafeHashFromBytes ∷ ByteString → Hash a
- hashToBytes ∷ AbstractHash algo a → ByteString
- decodeHash ∷ Text → Either Text (Hash a)
- hashHexF ∷ Format r (AbstractHash algo a → r)
- mediumHashF ∷ Format r (AbstractHash algo a → r)
- shortHashF ∷ Format r (AbstractHash algo a → r)
AbstractHash type supporting different hash algorithms
data AbstractHash algo a Source #
Hash wrapper with phantom type for more type-safety
Made abstract in order to support different algorithms
Instances
class HashAlgorithm a 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
Instances
| HashAlgorithm Blake2b_160 | |||||||||||||
Defined in Crypto.Hash.Blake2b Associated Types
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 # | |||||||||||||
| HashAlgorithm Blake2b_224 | |||||||||||||
Defined in Crypto.Hash.Blake2b Associated Types
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_256 | |||||||||||||
Defined in Crypto.Hash.Blake2b Associated Types
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_384 | |||||||||||||
Defined in Crypto.Hash.Blake2b Associated Types
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_512 | |||||||||||||
Defined in Crypto.Hash.Blake2b Associated Types
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 Blake2bp_512 | |||||||||||||
Defined in Crypto.Hash.Blake2bp Associated Types
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 Blake2s_160 | |||||||||||||
Defined in Crypto.Hash.Blake2s Associated Types
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 Blake2s_224 | |||||||||||||
Defined in Crypto.Hash.Blake2s Associated Types
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_256 | |||||||||||||
Defined in Crypto.Hash.Blake2s Associated Types
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 Blake2sp_224 | |||||||||||||
Defined in Crypto.Hash.Blake2sp Associated Types
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 Blake2sp_256 | |||||||||||||
Defined in Crypto.Hash.Blake2sp Associated Types
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 Keccak_224 | |||||||||||||
Defined in Crypto.Hash.Keccak Associated Types
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 Keccak_256 | |||||||||||||
Defined in Crypto.Hash.Keccak Associated Types
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_384 | |||||||||||||
Defined in Crypto.Hash.Keccak Associated Types
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_512 | |||||||||||||
Defined in Crypto.Hash.Keccak Associated Types
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 MD2 | |||||||||||||
Defined in Crypto.Hash.MD2 Associated Types
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 MD4 | |||||||||||||
Defined in Crypto.Hash.MD4 Associated Types
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 MD5 | |||||||||||||
Defined in Crypto.Hash.MD5 Associated Types
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 RIPEMD160 | |||||||||||||
Defined in Crypto.Hash.RIPEMD160 Associated Types
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 SHA1 | |||||||||||||
Defined in Crypto.Hash.SHA1 Associated Types
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 SHA224 | |||||||||||||
Defined in Crypto.Hash.SHA224 Associated Types
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 SHA256 | |||||||||||||
Defined in Crypto.Hash.SHA256 Associated Types
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 SHA3_224 | |||||||||||||
Defined in Crypto.Hash.SHA3 Associated Types
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 SHA3_256 | |||||||||||||
Defined in Crypto.Hash.SHA3 Associated Types
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_384 | |||||||||||||
Defined in Crypto.Hash.SHA3 Associated Types
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_512 | |||||||||||||
Defined in Crypto.Hash.SHA3 Associated Types
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 SHA384 | |||||||||||||
Defined in Crypto.Hash.SHA384 Associated Types
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 SHA512 | |||||||||||||
Defined in Crypto.Hash.SHA512 Associated Types
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 SHA512t_224 | |||||||||||||
Defined in Crypto.Hash.SHA512t Associated Types
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 SHA512t_256 | |||||||||||||
Defined in Crypto.Hash.SHA512t Associated Types
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 Skein256_224 | |||||||||||||
Defined in Crypto.Hash.Skein256 Associated Types
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 Skein256_256 | |||||||||||||
Defined in Crypto.Hash.Skein256 Associated Types
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 Skein512_224 | |||||||||||||
Defined in Crypto.Hash.Skein512 Associated Types
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 Skein512_256 | |||||||||||||
Defined in Crypto.Hash.Skein512 Associated Types
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_384 | |||||||||||||
Defined in Crypto.Hash.Skein512 Associated Types
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_512 | |||||||||||||
Defined in Crypto.Hash.Skein512 Associated Types
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 Tiger | |||||||||||||
Defined in Crypto.Hash.Tiger Associated Types
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 Whirlpool | |||||||||||||
Defined in Crypto.Hash.Whirlpool Associated Types
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 # | |||||||||||||
| (IsDivisibleBy8 bitlen, KnownNat bitlen, IsAtLeast bitlen 8, IsAtMost bitlen 512) ⇒ HashAlgorithm (Blake2b bitlen) | |||||||||||||
Defined in Crypto.Hash.Blake2 Associated Types
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 512) ⇒ HashAlgorithm (Blake2bp bitlen) | |||||||||||||
Defined in Crypto.Hash.Blake2 Associated Types
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 (Blake2s bitlen) | |||||||||||||
Defined in Crypto.Hash.Blake2 Associated Types
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 # | |||||||||||||
| (IsDivisibleBy8 bitlen, KnownNat bitlen, IsAtLeast bitlen 8, IsAtMost bitlen 256) ⇒ HashAlgorithm (Blake2sp bitlen) | |||||||||||||
Defined in Crypto.Hash.Blake2 Associated Types
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 # | |||||||||||||
| KnownNat bitlen ⇒ HashAlgorithm (SHAKE128 bitlen) | |||||||||||||
Defined in Crypto.Hash.SHAKE Associated Types
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 # | |||||||||||||
| KnownNat bitlen ⇒ HashAlgorithm (SHAKE256 bitlen) | |||||||||||||
Defined in Crypto.Hash.SHAKE Associated Types
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 # | |||||||||||||
Hashing
abstractHash ∷ (HashAlgorithm algo, EncCBOR a) ⇒ a → AbstractHash algo a Source #
Hash the EncCBOR-serialised version of a value
Once this is no longer used outside this module it should be made private.
unsafeAbstractHash ∷ HashAlgorithm algo ⇒ LByteString → AbstractHash algo a Source #
Hash a lazy LByteString
You can choose the phantom type, hence the "unsafe".
Conversion
abstractHashFromDigest ∷ Digest algo → AbstractHash algo a Source #
Make an AbstractHash from a Digest for the same HashAlgorithm.
abstractHashFromBytes ∷ HashAlgorithm algo ⇒ ByteString → Maybe (AbstractHash algo a) Source #
Make an AbstractHash from the bytes representation of the hash. It will
fail if given the wrong number of bytes for the choice of HashAlgorithm.
unsafeAbstractHashFromBytes ∷ ByteString → AbstractHash algo a Source #
Like abstractHashFromDigestBytes but the number of bytes provided
must be correct for the choice of HashAlgorithm.
abstractHashToBytes ∷ AbstractHash algo a → ByteString Source #
The bytes representation of the hash value.
unsafeAbstractHashFromShort ∷ ShortByteString → AbstractHash algo a Source #
The ShortByteString representation of the hash value.
abstractHashToShort ∷ AbstractHash algo a → ShortByteString Source #
The ShortByteString representation of the hash value.
Parsing and printing
decodeAbstractHash ∷ HashAlgorithm algo ⇒ Text → Either Text (AbstractHash algo a) Source #
Parses given hash in base16 form.
Standard Hash type using Blake2b 256
type Hash = AbstractHash Blake2b_256 Source #
The type of our commonly used hash, Blake2b 256
Hashing
Conversion
hashFromBytes ∷ ByteString → Maybe (Hash a) Source #
Make a hash from it bytes representation. It must be a 32-byte bytestring. The size is checked.
unsafeHashFromBytes ∷ ByteString → Hash a Source #
Make a hash from a 32-byte bytestring. It must be exactly 32 bytes.
hashToBytes ∷ AbstractHash algo a → ByteString Source #
The bytes representation of the hash value.
Parsing and printing
mediumHashF ∷ Format r (AbstractHash algo a → r) Source #
shortHashF ∷ Format r (AbstractHash algo a → r) Source #