MESSAGE AUTHENTICATION
In cryptography, a message authentication code (MAC) is a short
piece of information used to authenticate a message—in other
words, to provide integrity and authenticity assurances on the message. A message authentication code (MAC) is a cryptographic checksum on data that uses a session key to detect both accidental and intentional modifications of the data.
piece of information used to authenticate a message—in other
words, to provide integrity and authenticity assurances on the message. A message authentication code (MAC) is a cryptographic checksum on data that uses a session key to detect both accidental and intentional modifications of the data.
A MAC requires two inputs: a message and a secret key known only to the originator of the message and its intended recipient(s). This allows the recipient of the message to verify the integrity of the message and authenticate that the messege's sender has the shared secret key. If a sender doesn’t know the secret key, the hash value would then be different, which would tell the recipient that the message was not from the original sender.
There are four types of MACs: unconditionally secure, hash function-based, stream cipher-based and block cipher-based In the past, the most common approach to creating a MAC was to use block ciphers like Data Encryption Standard (DES), but hash-based MACs (HMACs) which use a secret key in conjunction with a cryptographic hash function to produce a hash, have become more widely used.