License | BSD-style |
---|---|
Maintainer | Matthias Valvekens <dev@mvalvekens.be> |
Stability | experimental |
Portability | unknown |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Expose a MAC interface to the keyed Blake2 algorithms defined in RFC 7693.
Synopsis
- class HashAlgorithm a => HashBlake2 a
- newtype KeyedBlake2 a = KeyedBlake2 {}
- keyedBlake2 :: (HashBlake2 a, ByteArrayAccess key, ByteArrayAccess ba) => key -> ba -> KeyedBlake2 a
- keyedBlake2Lazy :: (HashBlake2 a, ByteArrayAccess key) => key -> ByteString -> KeyedBlake2 a
- data Context a
- initialize :: forall a key. (HashBlake2 a, ByteArrayAccess key) => key -> Context a
- update :: (HashBlake2 a, ByteArrayAccess ba) => Context a -> ba -> Context a
- updates :: (HashBlake2 a, ByteArrayAccess ba) => Context a -> [ba] -> Context a
- finalize :: HashBlake2 a => Context a -> KeyedBlake2 a
Documentation
class HashAlgorithm a => HashBlake2 a Source #
Typeclass for the Blake2 family of digest functions.
blake2InternalKeyedInit
Instances
(IsDivisibleBy8 bitlen, KnownNat bitlen, IsAtLeast bitlen 8, IsAtMost bitlen 512) => HashBlake2 (Blake2b bitlen) Source # | |
Defined in Crypto.Hash.Blake2 | |
(IsDivisibleBy8 bitlen, KnownNat bitlen, IsAtLeast bitlen 8, IsAtMost bitlen 512) => HashBlake2 (Blake2bp bitlen) Source # | |
Defined in Crypto.Hash.Blake2 | |
(IsDivisibleBy8 bitlen, KnownNat bitlen, IsAtLeast bitlen 8, IsAtMost bitlen 256) => HashBlake2 (Blake2s bitlen) Source # | |
Defined in Crypto.Hash.Blake2 | |
(IsDivisibleBy8 bitlen, KnownNat bitlen, IsAtLeast bitlen 8, IsAtMost bitlen 256) => HashBlake2 (Blake2sp bitlen) Source # | |
Defined in Crypto.Hash.Blake2 |
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.
Instances
NFData (KeyedBlake2 a) Source # | |
Defined in Crypto.MAC.KeyedBlake2 rnf :: KeyedBlake2 a -> () # | |
Eq (KeyedBlake2 a) Source # | |
Defined in Crypto.MAC.KeyedBlake2 (==) :: KeyedBlake2 a -> KeyedBlake2 a -> Bool # (/=) :: KeyedBlake2 a -> KeyedBlake2 a -> Bool # | |
ByteArrayAccess (KeyedBlake2 a) Source # | |
Defined in Crypto.MAC.KeyedBlake2 length :: KeyedBlake2 a -> Int # withByteArray :: KeyedBlake2 a -> (Ptr p -> IO a0) -> IO a0 # copyByteArrayToPtr :: KeyedBlake2 a -> Ptr p -> IO () # |
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
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.