5 #ifndef CRYPTOPP_IMPORTS 13 AssertValidKeyLength(keylength);
18 unsigned int blockSize = hash.
BlockSize();
21 throw InvalidArgument(
"HMAC: can only be used with a block-based hash function");
23 m_buf.resize(2*AccessHash().BlockSize() + AccessHash().DigestSize());
25 if (keylength <= blockSize)
26 memcpy(AccessIpad(), userKey, keylength);
29 AccessHash().CalculateDigest(AccessIpad(), userKey, keylength);
34 memset(AccessIpad()+keylength, 0, blockSize-keylength);
36 for (
unsigned int i=0; i<blockSize; i++)
38 AccessOpad()[i] = AccessIpad()[i] ^ 0x5c;
39 AccessIpad()[i] ^= 0x36;
An invalid argument was detected.
#define NAMESPACE_BEGIN(x)
Classes for HMAC message authentication codes.
void Update(const byte *input, size_t length)
Updates a hash with additional input.
void Restart()
Restart the hash.
#define CRYPTOPP_ASSERT(exp)
void TruncatedFinal(byte *mac, size_t size)
Computes the hash of the current message.
uint8_t const size_t const size
void * memcpy(void *a, const void *b, size_t c)
virtual HashTransformation & AccessHash()=0
Interface for retrieving values given their names.