Message Authentication Code

With a standard Cryptographic Hash Function, an adversary can simply send m’ || H(m’) because the hashing algorithm is public.

MAC solves this by incorporating a Shared Secret Key (k) into the generation of the tag. It transforms the goal from just “Integrity” to “Integrity + Authenticity.”

How It Works

Unlike a standard hash function which takes one input (message), a MAC algorithm takes two inputs:

  1. Message (m)
  2. Secret Key (k)

The output is a short string of bits called the Tag (or authentication tag).

t=MAC(k,m)

Process

  1. Generation (Sender):
    • The sender and receiver share a secret key k in advance.
    • The sender computes t=MAC(k,m).
    • The sender transmits the pair: (m,t).
  2. Verification (Receiver):
    • The receiver gets the message m′ and the tag t′.
    • Using their copy of the secret key k, they compute their own tag: t=MAC(k,m′).
    • Comparison:
      • If t=t′, the message is authentic (came from someone with the key) and has integrity (was not modified).
      • If they do not match, the packet is discarded.

Why This Defeats the Adversary

If an attacker intercepts the message and modifies it to m’, they need to calculate a new tag t’ for it to be accepted.

  • Standard Hash: Easy, just run H(m′).
  • MAC: Impossible. The attacker does not know k, so they cannot compute MAC(k,m’). They cannot forge a valid tag.

Relevant Note(s):