10#include <botan/internal/xor_buf.h>
17void HMAC::add_data(
const byte input[],
size_t length)
19 hash->update(input, length);
25void HMAC::final_result(
byte mac[])
37void HMAC::key_schedule(
const byte key[],
size_t length)
40 std::fill(i_key.begin(), i_key.end(), 0x36);
41 std::fill(o_key.begin(), o_key.end(), 0x5C);
43 if(length > hash->hash_block_size())
45 SecureVector<byte> hmac_key = hash->process(key, length);
46 xor_buf(i_key, hmac_key, hmac_key.size());
47 xor_buf(o_key, hmac_key, hmac_key.size());
73 return "HMAC(" + hash->name() +
")";
81 return new HMAC(hash->clone());
89 if(hash->hash_block_size() == 0)
92 i_key.resize(hash->hash_block_size());
93 o_key.resize(hash->hash_block_size());
MessageAuthenticationCode * clone() const
size_t output_length() const
void zeroise(MemoryRegion< T > &vec)
void xor_buf(byte out[], const byte in[], size_t length)
std::invalid_argument Invalid_Argument