crypton-0.34: Cryptography Primitives sink
LicenseBSD-style
MaintainerMatthias Valvekens <dev@mvalvekens.be>
Stabilityexperimental
Portabilityunknown
Safe HaskellSafe-Inferred
LanguageHaskell2010

Crypto.MAC.KeyedBlake2

Contents

Description

Expose a MAC interface to the keyed Blake2 algorithms defined in RFC 7693.

Synopsis

Documentation

class HashAlgorithm a => HashBlake2 a Source #

Typeclass for the Blake2 family of digest functions.

Minimal complete definition

blake2InternalKeyedInit

Instances

Instances details
(IsDivisibleBy8 bitlen, KnownNat bitlen, IsAtLeast bitlen 8, IsAtMost bitlen 512) => HashBlake2 (Blake2b bitlen) Source # 
Instance details

Defined in Crypto.Hash.Blake2

Methods

blake2InternalKeyedInit :: Ptr (Context (Blake2b bitlen)) -> Ptr Word8 -> Word32 -> IO ()

(IsDivisibleBy8 bitlen, KnownNat bitlen, IsAtLeast bitlen 8, IsAtMost bitlen 512) => HashBlake2 (Blake2bp bitlen) Source # 
Instance details

Defined in Crypto.Hash.Blake2

Methods

blake2InternalKeyedInit :: Ptr (Context (Blake2bp bitlen)) -> Ptr Word8 -> Word32 -> IO ()

(IsDivisibleBy8 bitlen, KnownNat bitlen, IsAtLeast bitlen 8, IsAtMost bitlen 256) => HashBlake2 (Blake2s bitlen) Source # 
Instance details

Defined in Crypto.Hash.Blake2

Methods

blake2InternalKeyedInit :: Ptr (Context (Blake2s bitlen)) -> Ptr Word8 -> Word32 -> IO ()

(IsDivisibleBy8 bitlen, KnownNat bitlen, IsAtLeast bitlen 8, IsAtMost bitlen 256) => HashBlake2 (Blake2sp bitlen) Source # 
Instance details

Defined in Crypto.Hash.Blake2

Methods

blake2InternalKeyedInit :: Ptr (Context (Blake2sp bitlen)) -> Ptr Word8 -> Word32 -> IO ()

newtype KeyedBlake2 a Source #

Represent a Blake2b MAC that is a phantom type with the hash used to produce the MAC.

The Eq instance is constant time. No Show instance is provided, to avoid printing by mistake.

Constructors

KeyedBlake2 

Instances

Instances details
NFData (KeyedBlake2 a) Source # 
Instance details

Defined in Crypto.MAC.KeyedBlake2

Methods

rnf :: KeyedBlake2 a -> () #

Eq (KeyedBlake2 a) Source # 
Instance details

Defined in Crypto.MAC.KeyedBlake2

ByteArrayAccess (KeyedBlake2 a) Source # 
Instance details

Defined in Crypto.MAC.KeyedBlake2

keyedBlake2 :: (HashBlake2 a, ByteArrayAccess key, ByteArrayAccess ba) => key -> ba -> KeyedBlake2 a Source #

Compute a Blake2 MAC using the supplied key.

keyedBlake2Lazy :: (HashBlake2 a, ByteArrayAccess key) => key -> ByteString -> KeyedBlake2 a Source #

Compute a Blake2 MAC using the supplied key, for a lazy input.

Incremental

data Context a Source #

Represent an ongoing Blake2 state, that can be appended with update and finalized to a KeyedBlake2 with finalize.

initialize :: forall a key. (HashBlake2 a, ByteArrayAccess key) => key -> Context a Source #

Initialize a new incremental keyed Blake2 context with the supplied key.

update :: (HashBlake2 a, ByteArrayAccess ba) => Context a -> ba -> Context a Source #

Incrementally update a keyed Blake2 context.

updates :: (HashBlake2 a, ByteArrayAccess ba) => Context a -> [ba] -> Context a Source #

Incrementally update a keyed Blake2 context with multiple inputs.

finalize :: HashBlake2 a => Context a -> KeyedBlake2 a Source #

Finalize a keyed Blake2 context and return the computed MAC.