Encryption Observer

Glossary The basics

Message authentication codes (MACs)

A MAC is a short code calculated from a message and a secret key. The receiver recalculates it with the same key. If the codes match, the message has not been tampered with and came from someone who holds the key.

Think of it like this

A tamper seal that only you and your bank know how to make.

Why it matters

Encryption alone does not stop tampering. MACs, or encryption modes with a built-in MAC, make sure scrambled data has not been altered in transit.

Where you meet it

Every secure web connection, payment messages between banks, and login cookies on websites.

MessageShared keyMake tagsentMessageplus tagthe receiver makes the tag again with the same keyTags matchunchangedTags differtampered with
Both sides share a secret key. The receiver makes the tag again and compares. A changed message gives a different tag.

More diagrams: Encoding, hashing, encryption, MACs and hiding side by side · Inside a TLS 1.3 connection

Go deeper history and technical detail

HMAC, published in 1996 by Mihir Bellare, Ran Canetti and Hugo Krawczyk, builds a MAC from a hash function. Modern 'authenticated encryption' modes such as AES-GCM and ChaCha20-Poly1305 encrypt and authenticate in one step. A MAC differs from a signature: both sides share the same key, so it cannot prove to a third party which of them created it.

Read or watch next

Related terms

Cite this page Encryption Observer, “Message authentication codes (MACs)”, encryption.observer/terms/mac/, checked December 2026.