Skip to content

Message Authentication Code

A secret-key-dependent tag and verification test that binds a specified message to a key-holding group for integrity and origin assurance, without itself supplying secrecy or freshness.

Core Idea

A message authentication code (MAC) is a short, secret-key-dependent tag over specified message data, together with a key-holder's verification test. If the construction, key handling and input boundaries are sound, matching the tag supports integrity of the covered bytes and origin from someone able to use the key. It does not identify one holder among several who share that key.[1][2]

HMAC implements the relation using a keyed cryptographic hash; AES-CMAC uses a block cipher. They are distinct algorithms but instantiate the same keyed message–tag–check pattern. A MAC is therefore not simply a “keyed hash function.”[2][3]

How would you explain it like I'm…

The Secret-Stamp Check

Two friends share a secret password. When one sends a note, she adds a special stamp made with the password. The other friend checks the stamp with the same password. If it matches, she knows the note wasn't changed and came from someone who knows the secret — though she can't tell which person who knows it.

A Tag Only Key-Holders Can Make

A message authentication code, or MAC, is a short tag added to a message using a secret key that the sender and receiver share. The receiver uses the same key to check the tag. If the tag checks out, the message probably wasn't changed, and it was made by someone who has the key. But if several people share the key, it can't tell which one made it. Different recipes exist for making MACs, but they all use a secret key.

Keyed Message Integrity Tag

A message authentication code (MAC) is a cryptographic tool that uses a secret key to link a message to a short tag. Someone holding the key generates the tag for a message; a verifier with the matching key checks whether that message and tag go together. If verification succeeds — using a sound construction and a reasonable threat model — it shows the message wasn't altered and that the tag was produced by someone with access to the key. It doesn't identify which key holder sent it if the key is shared. A MAC is not just 'hashing the message': an ordinary hash can be recomputed by anyone, so it doesn't prove who made it. HMAC builds a MAC from a hash function with a key, and CMAC builds one from a block cipher.

 

A message authentication code (MAC) is a secret-key-dependent relation among a message, a short tag, and a verification decision. A holder of the key generates a tag over a specified message, and a verifier with the corresponding key checks whether message and tag match. Given a sound construction, appropriate key management and threat model, successful verification supports two claims: the covered data were not altered, and the tag was produced by an entity able to use the key. Because the key is shared, a MAC does not distinguish among individual key holders, unlike a digital signature. The defining structure is keyed verification, not 'hashing the message': HMAC implements it with a keyed cryptographic-hash construction, while CMAC uses a block cipher, both instantiating the same message–key–tag–check architecture. An unkeyed digest can detect changes only if the digest itself is independently trusted, and since anyone can recompute it, it does not establish origin.

Scope of Application

In RFC 7366's negotiated TLS/DTLS block-cipher encrypt-then-MAC mode, a record MAC covers selected record metadata and ciphertext and is checked before decryption. The cipher provides secrecy separately; the extension does not apply to AEAD suites.[4] In RFC 4494, AES-CMAC-96 authenticates IPsec AH/ESP packet material; IPsec AH sequence-number anti-replay is another, separately enabled receiver service.[5][6]

Both are literal MAC instances but differ in underlying algorithm and protocol envelope. A bare replay of a valid message/tag pair can still pass its MAC check. Public non-repudiation is also not a property of a shared-key MAC, because ordinary key holders can both check and generate tags.[6][1]

Clarity

The useful distinction is between covered-data integrity, key-holder origin, freshness, and Confidentiality. A MAC supports the first two within its threat model; a replay check and encryption answer the latter questions. This avoids treating a valid but stale tag as a cryptographic break or an encrypted record as automatically authenticated.[4][6]

Manages Complexity

The many bits of a message are reduced to a bounded keyed tag whose verification tests the selected input. Analysis then concentrates on the key group, exact covered bytes, algorithm assumptions, tag length and receiver decision rather than an unspecific claim that the whole transmission is “secure.” Protocols can combine this component with distinct secrecy or anti-replay mechanisms.[1][2][6]

Abstract Reasoning

For a candidate use, identify message \(m\), key context \(k\), tag \(t\), and test \(V_k(m,t)\). Ask which bytes enter \(m\) and who can make a new valid \(t\). If covered data are altered while an old tag is kept, sound verification should reject. If the original pair is merely replayed, the MAC relation still matches, so a separate freshness rule must decide whether to accept the event.[2][6]

Tag truncation is a further contextual choice. RFC 4494 uses a 96-bit truncated AES-CMAC tag for IPsec; fewer transmitted bits save space but reduce blind-guessing margin. That tradeoff cannot be judged apart from a specified construction and protocol.[5]

Knowledge Transfer

The same keyed tag-and-check relation is recognizable in record and packet protection, even when HMAC and CMAC use different internal machinery. It does not literally transfer to unkeyed hashing, digital signatures or every AEAD/GCM tag. Live Authentication is a related but non-parent identity because its structural signature requires freshness, which a MAC alone does not provide. A broader keyed-attestation skeleton remains a future-prime question; the staged MAC node is deliberately unparented.[2][3][4]

Neighborhood in Abstraction Space

Message Authentication Code sits in a moderately populated region (49th percentile for distinctiveness): it has near-neighbors but no dense thicket of look-alikes.

Family — Network Security Vulnerabilities & Trust (32 abstractions)

Nearest neighbors

Computed from structural-signature embeddings · 2026-11-14

References

[1] NIST Computer Security Resource Center, “Message authentication code (MAC)” glossary, definitions from NIST SP 800-38B and SP 800-63-4. https://csrc.nist.gov/glossary/term/message_authentication_code registry ↩a ↩b ↩c

[2] Hugo Krawczyk, Mihir Bellare and Ran Canetti, “HMAC: Keyed-Hashing for Message Authentication,” RFC 2104 (1997), §§1–3 and §6. https://www.rfc-editor.org/rfc/rfc2104.html registry ↩a ↩b ↩c ↩d ↩e

[3] JH. Song, R. Poovendran, J. Lee and T. Iwata, “The AES-CMAC Algorithm,” RFC 4493 (2006). https://www.rfc-editor.org/rfc/rfc4493.html registry ↩a ↩b

[4] Peter Gutmann, “Encrypt-then-MAC for Transport Layer Security (TLS) and Datagram Transport Layer Security (DTLS),” RFC 7366 (2014), §3. https://www.rfc-editor.org/rfc/rfc7366.html registry ↩a ↩b ↩c

[5] JH. Song, R. Poovendran and J. Lee, “The AES-CMAC-96 Algorithm and Its Use with IPsec,” RFC 4494 (2006), §§1–4. https://www.rfc-editor.org/rfc/rfc4494.html registry ↩a ↩b

[6] Stephen Kent, “IP Authentication Header,” RFC 4302 (2005), §§2.5 and 3.4.3–3.4.4. https://www.rfc-editor.org/rfc/rfc4302.html registry ↩a ↩b ↩c ↩d ↩e