3 #ifndef CRYPTOPP_HMAC_H
4 #define CRYPTOPP_HMAC_H
9 NAMESPACE_BEGIN(CryptoPP)
16 void UncheckedSetKey(
const byte *userKey,
unsigned int keylength,
const NameValuePairs ¶ms);
19 void Update(
const byte *input,
size_t length);
20 void TruncatedFinal(byte *mac,
size_t size);
26 byte * AccessIpad() {
return m_buf;}
27 byte * AccessOpad() {
return m_buf + AccessHash().
BlockSize();}
28 byte * AccessInnerHash() {
return m_buf + 2*AccessHash().BlockSize();}
34 bool m_innerHashKeyed;
43 CRYPTOPP_CONSTANT(DIGESTSIZE=T::DIGESTSIZE)
44 CRYPTOPP_CONSTANT(BLOCKSIZE=T::BLOCKSIZE)
47 HMAC(
const byte *key,
size_t length=HMAC_Base::DEFAULT_KEYLENGTH)
48 {this->
SetKey(key, length);}
50 static std::string StaticAlgorithmName() {
return std::string(
"HMAC(") + T::StaticAlgorithmName() +
")";}
51 std::string
AlgorithmName()
const {
return std::string(
"HMAC(") + m_hash.AlgorithmName() +
")";}
interface for message authentication codes
virtual void SetKey(const byte *key, size_t length, const NameValuePairs ¶ms=g_nullNameValuePairs)
set or reset the key of this object
unsigned int DigestSize() const
size of the hash/digest/MAC returned by Final()
support query of variable key length, template parameters are default, min, max, multiple (default mu...
std::string AlgorithmName() const
returns name of this algorithm, not universally implemented yet
interface for retrieving values given their names
unsigned int OptimalBlockSize() const
input to Update() should have length a multiple of this for optimal speed