Exchange fresh toy Diffie-Hellman shares and manually compute the same shared secret. This is toy arithmetic only, not deployable security.

Example

Exchange fresh toy Diffie-Hellman shares and manually compute the same shared secret.

highlighted = computed this step

Step 1 — DH setup

Set up the exact toy cryptography values.

p, g(23, 5)\begin{array}{c|c}\text{p, g}&\text{(23, 5)}\end{array}

Step 2 — Client share

Compute the highlighted cryptography value.

a, A=g power a mod p(6, 8)\begin{array}{c|c}\text{a, A=g power a mod p}&\hlmath{\text{(6, 8)}}\end{array}

Step 3 — Server share

Compute the highlighted cryptography value.

b, B=g power b mod p(15, 19)\begin{array}{c|c}\text{b, B=g power b mod p}&\hlmath{\text{(15, 19)}}\end{array}

Step 4 — Client secret

Compute the highlighted cryptography value.

B power a mod p2\begin{array}{c|c}\text{B power a mod p}&\hlmath{\text{2}}\end{array}

Step 5 — Server secret

Compute the highlighted cryptography value.

A power b mod p2\begin{array}{c|c}\text{A power b mod p}&\hlmath{\text{2}}\end{array}

Step 6 — Verdict

Compute the highlighted cryptography value.

verdictmatch\begin{array}{c|c}\text{verdict}&\hlmath{\text{match}}\end{array}
cryptography This lesson follows a tiny HTTPS-like protocol sequence so every value can be checked by hand.