Crypto::HmacContext< HashContext > Class Template Reference

HMAC class template. More...

#include <HmacContext.h>

Collaboration diagram for Crypto::HmacContext< HashContext >:

Public Types

using Engine = typename HashContext::Engine
 
using Hash = typename HashContext::Hash
 

Public Member Functions

 HmacContext ()=default
 Default HMAC constructor. More...
 
 HmacContext (const Secret &key)
 Initialise HMAC context with key. More...
 
HmacContextinit (const Secret &key)
 Initialise HMAC with key. More...
 
template<typename... Ts>
HmacContextupdate (Ts &&... args)
 Update HMAC with some message content. More...
 
Hash getHash ()
 
template<typename... Ts>
Hash calculate (Ts &&... args)
 Calculate hash for some data. More...
 

Static Public Attributes

static constexpr size_t blocksize = Engine::blocksize
 

Detailed Description

template<class HashContext>
class Crypto::HmacContext< HashContext >

HMAC class template.

Implements the HMAC algorithm using any defined hash context

Member Typedef Documentation

◆ Engine

template<class HashContext >
using Crypto::HmacContext< HashContext >::Engine = typename HashContext::Engine

◆ Hash

template<class HashContext >
using Crypto::HmacContext< HashContext >::Hash = typename HashContext::Hash

Constructor & Destructor Documentation

◆ HmacContext() [1/2]

template<class HashContext >
Crypto::HmacContext< HashContext >::HmacContext ( )
default

Default HMAC constructor.

Must call init() first.

◆ HmacContext() [2/2]

template<class HashContext >
Crypto::HmacContext< HashContext >::HmacContext ( const Secret key)
inline

Initialise HMAC context with key.

Member Function Documentation

◆ calculate()

template<class HashContext >
template<typename... Ts>
Hash Crypto::HmacContext< HashContext >::calculate ( Ts &&...  args)
inline

Calculate hash for some data.

Use like this:

    auto hash = Crypto::HmacMd5(mySecret).calculate(myData);
Parameters
argsSee HashContext update() methods
Return values
Hash

◆ getHash()

template<class HashContext >
Hash Crypto::HmacContext< HashContext >::getHash ( )
inline

◆ init()

template<class HashContext >
HmacContext& Crypto::HmacContext< HashContext >::init ( const Secret key)
inline

Initialise HMAC with key.

Return values
Referenceto enable method chaining

◆ update()

template<class HashContext >
template<typename... Ts>
HmacContext& Crypto::HmacContext< HashContext >::update ( Ts &&...  args)
inline

Update HMAC with some message content.

Parameters
argsSee HashContext update() methods
Return values
Referenceto enable method chaining

Member Data Documentation

◆ blocksize

template<class HashContext >
constexpr size_t Crypto::HmacContext< HashContext >::blocksize = Engine::blocksize
staticconstexpr

The documentation for this class was generated from the following file: