MAC Definition
A MAC (Message Authentication Code) used to obtain certainty about the origin of data or messages and their integrity check.
MAC algorithms require two input parameters, firstly the data to be protected and secondly a secret key, and use both to calculate message authentication code.
It values protect both the message’s data integrity as well as its authenticity by allowing verifiers to detect any changes to the message content.
How does MAC work?
- The sender calculates a MAC for this key and its message and then sends the message and the MAC to the recipient.
- It calculates the MAC for the received message with the key and compares the calculated MAC with the received one.
- The recipient interprets the agreement of both values as a successful integrity test.
- The message sent by a party who knows the secret key, and it did not change during the transmission.
- MACs do not protect against replay attacks. To do this, the message itself must contain data that ensure that repetitions can be detected.
What are hash functions and digital signatures in [MAC]?
- Cryptographic hash functions used to calculate MACs, but it goes beyond the use of simple hash values.
- If a message only transmits with its hash value as a MAC, this would not be certain since the hash function is publicly known.
- An attacker could modify the message and calculate a new hash value for the original message and transmit it.
- However, if the sender and recipient share a secret, this can be included in the hash calculation.
- Even if the manipulation security of MACs suggests a relationship with digital signatures, there are differences between the two methods.
- MACs differ from digital signatures in that checking the MACs requires knowledge of the same secret key that used to calculate it.
- Therefore, anyone who can check a MAC can also calculate it. And he is accordingly not in a position to prove to third party who sent the message.