Opening your learning space
Starting the app …
Opening your learning space
Starting the app …
Diffie–Hellman lets two parties derive the same modular group value from public messages without sending their private exponents.
Free to browse · flashcards or a multiple-choice quiz · import from Essential
Formula
a, b, g, p, A, B and K are integers or residue classes; no physical unit
| Symbol | Meaning | Unit |
|---|---|---|
| Prime modulus defining the finite-field setting | integer | |
| Public group element of suitable order modulo p | residue class modulo p | |
| Private secret exponents of the two parties | integer | |
| Public values gᵃ mod p and gᵇ mod p | residue class modulo p | |
| Shared modular group value before key derivation | residue class modulo p |
A=g^a\bmod p,\quad B=g^b\bmod p,\quad K_A=B^a\bmod p=K_B=A^b\bmod p=g^{ab}\bmod pThe equality follows from (gᵇ)^a≡(gᵃ)^b≡g^(ab) mod p. The teaching model assumes p and g describe a suitable group with sufficiently large order; arithmetic modulo an arbitrary number is not secure parameter selection. The exchange alone does not authenticate either party and is vulnerable to man-in-the-middle attacks. The shared K is not yet an application key: real protocols need authentication, standardized groups, key derivation and secure implementations. Small numbers are only for hand calculation. The RFC supplies the equation; CS2023 lists security as a knowledge area.
The equality follows from (gᵇ)^a≡(gᵃ)^b≡g^(ab) mod p. The teaching model assumes p and g describe a suitable group with sufficiently large order; arithmetic modulo an arbitrary number is not secure parameter selection. The exchange alone does not authenticate either party and is vulnerable to man-in-the-middle attacks. The shared K is not yet an application key: real protocols need authentication, standardized groups, key derivation and secure implementations. Small numbers are only for hand calculation. The RFC supplies the equation; CS2023 lists security as a knowledge area.
Diffie–Hellman lets two parties derive the same modular group value from public messages without sending their private exponents.
Gemeinsames Geheimnis
Gilt im selben geeigneten endlichen Gruppenmodell.
Use the example for Diffie–Hellman key exchange (teaching model) to explain which inputs determine the requested output.
The example connects concrete inputs to its result.
Diffie–Hellman lets two parties derive the same modular group value from public messages without sending their private exponents.
The relation applies only under its stated assumptions.
For p=23, g=5, a=6 and b=15, calculate both public values and the shared residue.
A=56 mod 23=8 and B=515 mod 23=19.
Then B6 mod 23=2 and A15 mod 23=2.
These parameters are an insecure hand-calculation example, not a production key.
Applying the relation to a different case without checking its stated assumptions.
Check the validity range before substituting values: The equality follows from (gᵇ)^a≡(gᵃ)^b≡g^(ab) mod p. The teaching model assumes p and g describe a suitable group with sufficiently large order; arithmetic modulo an arbitrary number is not secure.
Formula cluster
Diffie–Hellman lets two parties derive the same modular group value from public messages without sending their private exponents.
Only as an insecure arithmetic example: p=23, g=5, a=6 and b=15. Then A=56 mod 23=8 and B=515 mod 23=19. Alice computes 196 mod 23=2; Bob obtains 815 mod 23=2. Check: both equal 590 mod 23=2. These tiny parameters are immediately breakable and must never be used in production.
Understand modular arithmetic and the idea of key agreement; this is not a guide to production cryptography.
Here is how to work through a typical Diffie–Hellman key exchange (teaching model) (A=gᵃ mod p; B=gᵇ mod p; K=Bᵃ=Aᵇ mod p) task step by step:
Task
Use the example for Diffie–Hellman key exchange (teaching model) to explain which inputs determine the requested output.
Solution path
The example connects concrete inputs to its result.
Diffie–Hellman lets two parties derive the same modular group value from public messages without sending their private exponents.
The relation applies only under its stated assumptions.
Task
For p=23, g=5, a=6 and b=15, calculate both public values and the shared residue.
Solution path
A=56 mod 23=8 and B=515 mod 23=19.
Then B6 mod 23=2 and A15 mod 23=2.
These parameters are an insecure hand-calculation example, not a production key.
Alice publishes A=gᵃ mod p and Bob publishes B=gᵇ mod p while keeping their exponents secret. Alice raises B to a and obtains (gᵇ)ᵃ=gᵃᵇ modulo p. Bob raises A to b and obtains (gᵃ)ᵇ=gᵃᵇ modulo p. Exponent multiplication is commutative, so both residue classes match. An observer sees p, g, A and B but would need to solve a discrete-logarithm problem to recover a private exponent. Teaching model over a suitable finite group; example values are cryptographically insecure and must never be used in production.
p defines the modular number system and g is a public group element whose powers form the possible public values. A secure construction needs a suitable subgroup with known, large order; merely saying “p is prime” and choosing any g is not a complete parameter check. This page uses the equation to illustrate modular arithmetic. Production protocols select groups according to current standards and validate public values as required by the protocol. Teaching model over a suitable finite group; example values are cryptographically insecure and must never be used in production.
For p=23, g=5, a=6 and b=15, Alice computes A=56 mod 23=8 and Bob computes B=515 mod 23=19. Alice obtains B6 mod 23=196 mod 23=2; Bob obtains A15 mod 23=815 mod 23=2. Matching values check the equation. The numbers are intentionally small so repeated squaring can be checked by hand. For the same reason, a computer or attacker can recover the private exponents immediately. Teaching model over a suitable finite group; example values are cryptographically insecure and must never be used in production.
No. Without authentication, an attacker can impersonate Bob to Alice and Alice to Bob. The attacker then establishes two separate key agreements and relays messages between them. The bare equation does not prove who shares the key. Real protocols bind the exchange to certificates, signatures or other authenticated mechanisms and need careful key derivation. This page explains the mathematical idea; it is not a protocol specification or security review. Teaching model over a suitable finite group; example values are cryptographically insecure and must never be used in production.
K is initially only a modular group value and should not be used directly as a symmetric key in real protocols. A standardized key-derivation mechanism processes the shared secret together with context, roles and the protocol transcript to produce appropriately sized key material. An authenticated-encryption mode then protects the message and detects tampering. Randomness, ephemeral-key lifetime, identities and error handling also matter. The equation illustrates agreement on a shared value, not a complete secure communication channel. Teaching model over a suitable finite group; example values are cryptographically insecure and must never be used in production.
Quanta exam set
Curated exam set for "Diffie–Hellman key exchange (teaching model)":
Question (front)
Which formula describes Diffie–Hellman key exchange (teaching model)?
Answer in your set
Question (front)
How do you rearrange Diffie–Hellman key exchange (teaching model) for Gemeinsames Geheimnis?
Answer in your set
Question (front)
Which common mistake happens with Diffie–Hellman key exchange (teaching model)?
Answer in your set
+ 8 more cards: units, variables, derivation, example, exam task
The formula set contains 11 cards. After importing, review them and start practicing; your ratings determine later review intervals.
This list names subject references and further reading. A page or section number appears when it is part of the reference; these are not verbatim quotations.
Create a curated FSRS exam set for A=gᵃ mod p; B=gᵇ mod p; K=Bᵃ=Aᵇ mod p: formula recall, variables, derivation, rearrangement, worked example, common mistakes and exam context.
Curated formula set · LaTeX · FSRS spaced repetition · import from Essential