Add a tiny secret MAC key so the receiver can reject tampered ciphertext. This is toy arithmetic only, not deployable security.

Example

Add a tiny secret MAC key so the receiver can reject tampered ciphertext.

highlighted = computed this step

Step 1 — Set up

Set up the exact toy cryptography values.

cipher nibbles, mac key((1, 2, 12), 11)\begin{array}{c|c}\text{cipher nibbles, mac key}&\text{((1, 2, 12), 11)}\end{array}

Step 2 — Tag

Compute the highlighted cryptography value.

(sum(cipher)+mac_key) mod 16(15, 11, 10)\begin{array}{c|c}\text{(sum(cipher)+mac\_key) mod 16}&\hlmath{\text{(15, 11, 10)}}\end{array}

Step 3 — Verify

Compute the highlighted cryptography value.

recomputed tag vs sent tag(10, 10, match)\begin{array}{c|c}\text{recomputed tag vs sent tag}&\hlmath{\text{(10, 10, match)}}\end{array}

Final Step — Tamper check

Compute the highlighted cryptography value.

tampered tag check vs sent tag(11, 10, mismatch)\begin{array}{c|c}\text{tampered tag check vs sent tag}&\hlmath{\text{(11, 10, mismatch)}}\end{array}
cryptography This lesson uses a fixed toy tag formula to show the role of a secret authentication key. The sum-based tag is deliberately weak and can miss sum-preserving edits; it is not a real MAC.