MAC (message authentication code)

acronym

cryptography

Stands for: Message Authentication Code

A short tag that proves a message came from someone holding the shared key and was not altered.

A Message Authentication Code provides integrity and authenticity together: recompute it with the key and compare. HMAC is the common hash-based construction. Note the collision with "MAC address", an unrelated networking term; context disambiguates.

A message authentication code answers a question encryption does not: has this message been altered, and did it come from someone holding the shared key. Confidentiality and integrity are separate properties, and assuming the first delivers the second is one of the most expensive mistakes in applied cryptography.

The classic failure is order of operations. Encrypting a message and then computing the MAC over the ciphertext lets a recipient reject forgeries before decrypting anything. The reverse, authenticating the plaintext and then encrypting the pair, forces the recipient to decrypt attacker-supplied data before it has been validated, which is the door padding-oracle attacks walked through repeatedly. Encrypt-then-MAC is the order that survives.

This is precisely why AEAD constructions exist and why modern protocols reach for them instead. When authentication and encryption are one operation with one key, nobody can get the ordering wrong, and TLS 1.3 removed the alternatives rather than documenting them more carefully. Worth keeping distinct from a MAC address, which shares an acronym and nothing else.

Also known as: mac, message authentication code

All glossary entries