Go to the documentation of this file.
24 template <
class HashContext>
class HmacContext
29 static constexpr
size_t blocksize = Engine::blocksize;
54 memcpy(inputPad.data(),
key.data(),
key.size());
59 memcpy(inputPad.data(), hash.data(), hash.size());
64 for(
auto& c : inputPad) {
67 for(
auto& c : outputPad) {
84 ctx.
update(std::forward<Ts>(args)...);
110 ctx.
update(std::forward<Ts>(args)...);
115 ByteArray<blocksize> outputPad;
Wraps a pointer to some data with size.
Definition: Blob.h:28
std::array< uint8_t, size_ > ByteArray
Class template for fixed byte array.
Definition: ByteArray.h:32
Hash getHash()
Definition: HmacContext.h:104
static constexpr size_t blocksize
Definition: HmacContext.h:45
HmacContext & update(Ts &&... args)
Update HMAC with some message content.
Definition: HmacContext.h:98
Hash getHash()
Finalise and return the final hash value.
Definition: HashContext.h:120
void size_t const void * key
Definition: blake2s.h:33
ByteArray< Engine::hashsize > Hash
Definition: HashContext.h:42
Hash calculate(Ts &&... args)
Calculate hash for some data.
Definition: HmacContext.h:124
HmacContext & init(const Secret &key)
Initialise HMAC with key.
Definition: HmacContext.h:66
Engine_ Engine
Definition: HashContext.h:41
HmacContext()=default
Default HMAC constructor.
HashContext & update(const Blob &blob)
Data from Blob.
Definition: HashContext.h:80
HashContext & reset(EngineArgs &&... engineArgs)
Reset the context for a new calculation.
Definition: HashContext.h:57
typename HashContext::Engine Engine
Definition: HmacContext.h:43
HMAC class template.
Definition: HmacContext.h:32
Blob Secret
Identifies data which should be treated with care.
Definition: Blob.h:57
typename HashContext::Hash Hash
Definition: HmacContext.h:44