MAC
message authentication code
the propurse of MAC is to verify the intergrity of the message
sender
- use the hash function to get H(m)
- concate message and H(m)
- send the
H(m) + m
to the receiver
receiver
- get the
H(m) + m
from the sender - caculate the hash value of m
H(m)
- compare whether the hash value from the sendr equal to the value we just caculate
MAC only can verify the intergrity of the data
HMAC
HMAC is a specific type of message authentication code (MAC) involving a cryptographic hash function and a secret cryptographic key. It may be used to simultaneously verify both the data integrity and
HMAC 是MAC的一个子集元素
HMAC能够同时确保数据的完整性以及数据的身份验证