9 #include <botan/hmac.h>
10 #include <botan/internal/xor_buf.h>
17 void HMAC::add_data(
const byte input[],
size_t length)
19 hash->
update(input, length);
25 void HMAC::final_result(
byte mac[])
37 void 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);
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() +
")";
std::invalid_argument Invalid_Argument
virtual HashFunction * clone() const =0
MessageAuthenticationCode * mac
void update(const byte in[], size_t length)
SecureVector< byte > process(const byte in[], size_t length)
virtual std::string name() const =0
virtual size_t hash_block_size() const
MessageAuthenticationCode * clone() const
void xor_buf(byte out[], const byte in[], size_t length)
void zeroise(MemoryRegion< T > &vec)
size_t output_length() const