cryptonite-0.23: Cryptography Primitives sink

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

Crypto.MAC.HMAC

Contents

Description

provide the HMAC (Hash based Message Authentification Code) base algorithm. http://en.wikipedia.org/wiki/HMAC

Synopsis

Documentation

hmac Source #

Arguments

:: (ByteArrayAccess key, ByteArrayAccess message, HashAlgorithm a) 
=> key

Secret key

-> message

Message to MAC

-> HMAC a 

compute a MAC using the supplied hashing function

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

Instances

Eq (HMAC a) Source # 

Methods

(==) :: HMAC a -> HMAC a -> Bool #

(/=) :: HMAC a -> HMAC a -> Bool #

ByteArrayAccess (HMAC a) Source # 

Methods

length :: HMAC a -> Int #

withByteArray :: HMAC a -> (Ptr p -> IO a) -> IO a #

incremental

data Context hashalg Source #

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

Constructors

Context !(Context hashalg) !(Context hashalg) 

initialize Source #

Arguments

:: (ByteArrayAccess key, HashAlgorithm a) 
=> key

Secret key

-> Context a 

Initialize a new incremental HMAC context

update Source #

Arguments

:: (ByteArrayAccess message, HashAlgorithm a) 
=> Context a

Current HMAC context

-> message

Message to append to the MAC

-> Context a

Updated HMAC context

Incrementally update a HMAC context

updates Source #

Arguments

:: (ByteArrayAccess message, HashAlgorithm a) 
=> Context a

Current HMAC context

-> [message]

Messages to append to the MAC

-> Context a

Updated HMAC context

Increamentally update a HMAC context with multiple inputs

finalize :: HashAlgorithm a => Context a -> HMAC a Source #

Finalize a HMAC context and return the HMAC.