Link to this headingHMAC
- Similar to Symmetric Encryption as in both sides need the secret key to verify the integrity of the message
- Not vulnerable to Length Extension attacks because it uses the output the hash function as input to another and should be unique on each input
Link to this headingImplementation
assert
return
#Get hash_function block_size
=
# Check if key is longer than block size.
# IF it is then hash the key. This makes the keysize the same as the output of the hashfunction
=
# IF key is shorter
# Pad the key to blocksize
= + b *
#print(key, len(key), block_size)
# Create Keys
=
=
#Hash i_key and message
=
#Hash the o_key and the hashed output of above
return
#32885b49c8a1009e6d66662f8462e7dd5df769a7b725d1d546574e6d5d6e76ad