License | BSD-style |
---|---|
Maintainer | Vincent Hanquez <vincent@snarc.org> |
Stability | experimental |
Portability | unknown |
Safe Haskell | Trustworthy |
Language | Haskell98 |
Crypto hash generic MAC (Message Authentification Code) module
- newtype HMAC a = HMAC {
- hmacGetDigest :: Digest a
- hmac :: HashAlgorithm a => ByteString -> ByteString -> HMAC a
- hmacAlg :: HashAlgorithm a => a -> ByteString -> ByteString -> HMAC a
- data HMACContext hashalg
- hmacInit :: HashAlgorithm a => ByteString -> HMACContext a
- hmacInitAlg :: HashAlgorithm a => a -> ByteString -> HMACContext a
- hmacUpdate :: HashAlgorithm a => HMACContext a -> ByteString -> HMACContext a
- hmacFinalize :: HashAlgorithm a => HMACContext a -> HMAC a
MAC algorithms
Represent an HMAC that is a phantom type with the hash used to produce the mac.
The Eq instance is constant time.
HMAC | |
|
:: HashAlgorithm a | |
=> ByteString | Secret key |
-> ByteString | Message to MAC |
-> HMAC a |
compute a MAC using the supplied hashing function
:: 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
:: HashAlgorithm a | |
=> ByteString | Secret key |
-> HMACContext a |
Initialize a new incremental HMAC context
:: 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.
:: HashAlgorithm a | |
=> HMACContext a | |
-> ByteString | Message to Mac |
-> HMACContext a |
Incrementally update a HMAC context
hmacFinalize :: HashAlgorithm a => HMACContext a -> HMAC a Source
Finalize a HMAC context and return the HMAC.