cryptohash-0.11.6: collection of crypto hashes, fast, pure and practical

Portabilityunknown
Stabilityexperimental
MaintainerVincent Hanquez <vincent@snarc.org>
Safe HaskellTrustworthy

Crypto.MAC

Contents

Description

Crypto hash generic MAC (Message Authentification Code) module

Synopsis

MAC algorithms

newtype HMAC a Source

Represent an HMAC that is a phantom type with the hash used to produce the mac.

The Eq instance is constant time.

Constructors

HMAC 

Fields

hmacGetDigest :: Digest a
 

Instances

Eq (HMAC a) 
Byteable (HMAC a) 

hmacSource

Arguments

:: HashAlgorithm a 
=> ByteString

Secret key

-> ByteString

Message to MAC

-> HMAC a 

compute a MAC using the supplied hashing function

hmacAlgSource

Arguments

:: HashAlgorithm a 
=> a

the hash algorithm the actual value is unused.

-> ByteString

Secret key

-> ByteString

Message to MAC

-> HMAC a 

compute a HMAC using a specified algorithm

Incremental MAC algorithms

data HMACContext hashalg Source

Represent an ongoing HMAC state, that can be appended with hmacUpdate and finalize to an HMAC with hmacFinalize

hmacInitSource

Arguments

:: HashAlgorithm a 
=> ByteString

Secret key

-> HMACContext a 

Initialize a new incremental HMAC context

hmacInitAlgSource

Arguments

:: HashAlgorithm a 
=> a

the hash algorithm the actual value is unused.

-> ByteString

Secret key

-> HMACContext a 

Initialize a new incremental HMAC context with a given hash algorithm.

hmacUpdateSource

Arguments

:: HashAlgorithm a 
=> HMACContext a 
-> ByteString

Message to Mac

-> HMACContext a 

Incrementally update a HMAC context

hmacFinalize :: HashAlgorithm a => HMACContext a -> HMAC aSource

Finalize a HMAC context and return the HMAC.