cryptonite-0.25: Cryptography Primitives sink

LicenseBSD-style
MaintainerVincent Hanquez <vincent@snarc.org>
Stabilityexperimental
Portabilityunknown
Safe HaskellNone
LanguageHaskell2010

Crypto.Hash.IO

Description

Generalized impure cryptographic hash interface

Synopsis

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.

Associated Types

type HashBlockSize a :: Nat Source #

Associated type for the block size of the hash algorithm

type HashDigestSize a :: Nat Source #

Associated type for the digest size of the hash algorithm

type HashInternalContextSize a :: Nat Source #

Associated type for the internal context size of the hash algorithm

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

data MutableContext a Source #

A Mutable hash context

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