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.

Encoding, hashing, encryption, MACs and hiding side by sideGives no secrecyProtects data, in its own wayOnly encryption makes data unreadable without a key. The others do different jobs and are often confused with it.
  1. Encoding Changes how data is written so computers can carry it. Anyone can reverse it. Example: Base64 in email attachments, percent-encoding in web addresses Never use it to hide anything.
  2. Hashing Makes a fixed fingerprint that cannot be turned back into the original. Example: Password storage, file checks Easy-to-guess inputs can still be found by trying them.
  3. Encryption Scrambles data so only someone with the key can read it. Example: Messages, disks, websites The only one of the five that keeps the content secret.
  4. Message authentication code A short tag, made with a shared key, that shows the data has not been changed. Example: Every secure web connection Proves integrity, not secrecy.
  5. Steganography Hides the fact that a message exists, for example inside a photo. Example: Digital watermarks Usually combined with encryption in case it is found.

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.

Inside a TLS 1.3 connectionNeeds a post-quantum replacementStays safeFour algorithms work together. Only the key exchange and the certificate signature need a post-quantum replacement.
  1. 1Agree a secret Both sides combine key shares to make a shared secret. Typical choice: X25519, now paired with ML-KEM The hybrid with ML-KEM fixes this.
  2. 2Prove identity The server signs the conversation so far with its certificate's key. Typical choice: ECDSA or RSA Post-quantum certificates are still to come.
  3. 3Derive keys The shared secret is stretched into separate keys for each direction. Typical choice: HKDF with SHA-256 or SHA-384 Hash-based, so barely affected by quantum computers.
  4. 4Encrypt and tag Every record is encrypted and given a tag that detects tampering, with a unique number per record. Typical choice: AES-GCM or ChaCha20-Poly1305 Phones without AES hardware often use ChaCha20.
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.