Message Authentication Codes
1. What Is a MAC? (beginner — keyed fingerprint!)
MAC = fingerprint mixed with SECRET key: . Receiver recomputes with same — match? (1) unchanged! (2) from key-holder! Eve lacks → can't forge! Unlike hash (anyone recomputes!).
2. Flow (exam diagram!)
Alice: tag = MAC(K, "Pay ₹1000") → sends (message, tag)
Bob: recomputes MAC(K, received message) — equals tag? accept : reject!
Eve flips ₹1000→₹9000 → Bob's recompute differs → REJECTED!
3. Constructions (exam list!)
| Type | Idea | Example |
|---|---|---|
| Hash-based | nested hash with key | HMAC (standard!) |
| Cipher-based | last block of encrypted chain | CBC-MAC, CMAC (AES!) |
| Universal-hash | polynomial math (fast!) | UMAC, Poly1305 (ChaCha!) |
4. Rules (traps!)
- Needs SHARED key first (key-distribution problem — DH/RSA exchange it!).
- NO non-repudiation (both sides hold — either could forge! need signatures for court!).
- Verify in CONSTANT time (compare digests without early-exit — else timing leak!).
- Never plain with Merkle-Damgård (length-extension! use HMAC!).
5. Exam Points
- Define + flow + forge-proof — 5-7 marks, very frequent.
- Constructions + no-non-repudiation — 3-5 marks, frequent.