7 #ifndef CRYPTOPP_DMAC_H 8 #define CRYPTOPP_DMAC_H 21 static std::string
StaticAlgorithmName() {
return std::string(
"DMAC(") + T::StaticAlgorithmName() +
")";}
27 void UncheckedSetKey(
const byte *key,
unsigned int length,
const NameValuePairs ¶ms);
28 void Update(
const byte *input,
size_t length);
29 void TruncatedFinal(
byte *mac,
size_t size);
33 byte *GenerateSubKeys(
const byte *key,
size_t keylength);
38 typename T::Encryption
m_f2;
58 {this->
SetKey(key, length);}
75 m_mac1.
Update(input, length);
84 byte pad[T::BLOCKSIZE];
86 memset(pad, padByte, padByte);
87 m_mac1.
Update(pad, padByte);
89 m_f2.ProcessBlock(mac);
97 typename T::Encryption cipher(key, keylength);
98 memset(m_subkeys, 0, m_subkeys.
size());
99 cipher.ProcessBlock(m_subkeys);
100 m_subkeys[m_subkeys.
size()/2 + T::BLOCKSIZE - 1] = 1;
101 cipher.ProcessBlock(m_subkeys+m_subkeys.
size()/2);
void TruncatedFinal(byte *mac, size_t size)
Computes the hash of the current message.
Interface for message authentication codes.
virtual void SetKey(const byte *key, size_t length, const NameValuePairs ¶ms=g_nullNameValuePairs)
Sets or reset the key of this object.
DMAC message authentication code.
void resize(size_type newSize)
Change size and preserve contents.
#define NAMESPACE_BEGIN(x)
size_type size() const
Provides the count of elements in the SecBlock.
DMAC message authentication code base class.
Provides class member functions to key a message authentication code.
static std::string StaticAlgorithmName()
void TruncatedFinal(byte *mac, size_t size)
Computes the hash of the current message.
DMAC(const byte *key, size_t length=DMAC_Base< T >::DEFAULT_KEYLENGTH)
Construct a DMAC.
void Update(const byte *input, size_t length)
Updates a hash with additional input.
const T1 UnsignedMin(const T1 &a, const T2 &b)
Safe comparison of values that could be neagtive and incorrectly promoted.
Provides key lengths based on another class's key length.
#define CRYPTOPP_CONSTANT(x)
#define CRYPTOPP_NO_VTABLE
void Update(const byte *input, size_t length)
Updates a hash with additional input.
void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs ¶ms)
Sets the key for this object without performing parameter validation.
uint8_t const size_t const size
unsigned int DigestSize() const
Provides the digest size of the hash.
byte * GenerateSubKeys(const byte *key, size_t keylength)
Interface for retrieving values given their names.