Derive tiny application keys from the shared secret and both randoms. This is toy arithmetic only, not deployable security.

cryptography This lesson follows a tiny HTTPS-like protocol sequence so every value can be checked by hand.

Example

Derive tiny application keys from the shared secret and both randoms.

highlighted = computed this step

Step 1 — Inputs

Set up the exact toy cryptography values.

shared, client_random, server_random(2, 4, 9)\begin{array}{c|c}\text{shared, client\_random, server\_random}&\text{(2, 4, 9)}\end{array}

Step 2 — Encryption key

Compute the highlighted cryptography value.

(shared + client_random + server_random) mod 1615\begin{array}{c|c}\text{(shared + client\_random + server\_random) mod 16}&\hlmath{\text{15}}\end{array}

Step 3 — MAC key

Compute the highlighted cryptography value.

(shared * client_random + server_random) mod 161\begin{array}{c|c}\text{(shared * client\_random + server\_random) mod 16}&\hlmath{\text{1}}\end{array}