~/ learn/ comp-400/ cards/ Diffie–Hellman: agreeing on a secret with no secret
1 of 8

Run the full Diffie–Hellman exchange over q = 541 with α = 2, print both public values and both independently computed keys, and assert that they match.

Run the full Diffie–Hellman exchange over q = 541 with α = 2, print both public values and both independently computed keys, and assert that they match.

Answer

q, alpha = 541, 2 XA, XB = 97, 233 YA = pow(alpha, XA, q) YB = pow(alpha, XB, q) KA = pow(YB, XA, q) KB = pow(YA, XB, q) assert KA == KB print(YA, YB, KA, KB)

Stallings & Brown 5e ch2 §2.3; ch21 §21.5

space flip · ← → navigate · esc to exit
NORMAL ~/memra/library/31a8ab80-f928-42df-b3a6-a0143a594089/flashcard utf-8 LF