Encrypt, authenticate, and decrypt a tiny GET request after the toy handshake. This is toy arithmetic only, not deployable security.

Example

Encrypt, authenticate, and decrypt a tiny GET request after the toy handshake.

highlighted = computed this step

Step 1 — Request setup

Set up the exact toy cryptography values.

toy GET code nibbles, enc_key, mac_key((7, 5, 4), 15, 1)\begin{array}{c|c}\text{toy GET code nibbles, enc\_key, mac\_key}&\text{((7, 5, 4), 15, 1)}\end{array}

Step 2 — Encrypt byte 0

Compute the highlighted cryptography value.

index, plain, key, cipher, decrypt(0, 7, 15, 8, 7)\begin{array}{c|c}\text{index, plain, key, cipher, decrypt}&\hlmath{\text{(0, 7, 15, 8, 7)}}\end{array}

Step 3 — Encrypt byte 1

Compute the highlighted cryptography value.

index, plain, key, cipher, decrypt(1, 5, 0, 5, 5)\begin{array}{c|c}\text{index, plain, key, cipher, decrypt}&\hlmath{\text{(1, 5, 0, 5, 5)}}\end{array}

Step 4 — Encrypt byte 2

Compute the highlighted cryptography value.

index, plain, key, cipher, decrypt(2, 4, 1, 5, 4)\begin{array}{c|c}\text{index, plain, key, cipher, decrypt}&\hlmath{\text{(2, 4, 1, 5, 4)}}\end{array}

Step 5 — Request tag

Compute the highlighted cryptography value.

(sum(cipher)+mac_key) mod 16((8, 5, 5), 1, 3)\begin{array}{c|c}\text{(sum(cipher)+mac\_key) mod 16}&\hlmath{\text{((8, 5, 5), 1, 3)}}\end{array}

Final Step — Decrypt verdict

Compute the highlighted cryptography value.

server tag check, plaintext(match, (7, 5, 4))\begin{array}{c|c}\text{server tag check, plaintext}&\hlmath{\text{(match, (7, 5, 4))}}\end{array}
cryptography This lesson follows a tiny HTTPS-like protocol sequence so every value can be checked by hand.