What information entered the process?
Labs / Computer Science
Diffie-Hellman Exchange
Alice and Bob each keep a private key secret, yet they can agree on the same shared number by sending only public values across an open wire. Set their private keys, pick a prime and generator, and step through the exchange — then look at what the eavesdropper is stuck with.
Labs / Computer Science / Diffie-Hellman Exchange
Diffie-Hellman Exchange
Alice and Bob each keep a private key secret, yet they can agree on the same shared number by sending only public values across an open wire. Set their private keys, pick a prime and generator, and step through the exchange — then look at what the eavesdropper is stuck with.
Why it matters
Why explore this?
Computer science turns clear rules into reliable processes. This model lets you step through those rules and see how each decision changes the result.
Explore
Try the model
Investigate
Questions to test
Predict first, try it in the model, then use what you observe to answer.
What to try
- Alice sends A and Bob sends B, yet both end at the same s. How can two different public numbers lead to one identical secret?
- Change only Alice's private key. Which numbers on the wire change, and does Bob still land on the matching secret?
- Eve captures p, g, A, and B — every value that crossed the wire. Why can't she just reverse the math to recover the private keys?
- Switch to a larger prime like p = 197. How much harder does the “g to the x” guessing game get for Eve?
- What happens to the shared secret if you set a private key to 1? Is that a good key to choose, and why not?
Explain
Make sense of what happened
Trace the process one step at a time. Name the rule used at each important step, then explain why the final result follows from those rules.
Check
Before you leave
Which rule changed it?
Why did the process produce this result?
If you can answer all three using evidence from the model, you understand the main idea. If not, return to Explore and change one setting at a time.