Key-exchange clarification: pairwise key storage grows quadratically across the network, not exponentially. Bare Diffie–Hellman protects against passive eavesdropping; it needs authentication to resist an active man-in-the-middle. The generator must belong to the chosen group (in the elementary prime-field example, 1 < g < n). The finite-field number-field-sieve complexity is subexponential in the bit length of n, rather than the simplified expression in the source notes.
Key exchange is a fundamental challenge in cryptography, Traditional symmetric systems require a secure way to exchange secret keys beforehand. This creates a paradox: secure communication relies on already having a secure method for key exchange.
In a network with multiple users, each user must store a unique secret key with every n user on internet, resulting in an quadratic increase in the total number of keys to store and manage—impractical at large scales.

An Online Trusted Third Party (TTP) is introduced to simplify key management. TTPs are trusted entities that can generate and distribute session keys securely, helping reduce the number of keys each user must manage.

Limitations: The TTP needs to be contacted for every key exchange and is aware of all session keys, raising security and privacy concerns.
To eliminate reliance on a TTP, Diffie Hellman protocol was developed
Diffie Hellman protocol
Developed by Whitfield Diffie and Martin Hellman in 1976.
Enables two parties to establish a shared secret over an insecure channel.
We just need to secure against eavesdropping
Two numbers are agreed upon publicly:
n (Large prime number)
g (Generator) [1, n]
Each party selects a private key:
Party A chooses a private key a [1, n-1]
Party B chooses a private key b [1, n-1]
Each party computes their public key:
- Party A computes A= mod n
- Party B computes B= mod n
The public keys A and B are exchanged over the public channel.
Each party computes the shared secret using the other party's public key:
- Party A computes S = mod n
- Party B computes S = mod n
Both computations result in the same shared secret key, which can now be used for encryption.
Even if an attacker knows n, g, A, and B, they cannot easily compute S without knowing the private keys a and b.
| Transmitted over channel | Not transmitted over channel |
| n g A public key B public key | A private key B private key Shared secret |
Diffie Hellman problem (DH)
Calculating Shared secret S from public key A B without knowing private keys
~Calculating from without knowing a or b
The security of the DH protocol depends on the difficulty of the Discrete Logarithm Problem (DLP), which is finding a from A, n and g
General Number Field Sieve (GNFS) is the most efficient known algorithm to solve the
DLP for large prime numbers. it still has an exponential runtime.
| To generate Cipher key of size: | n ka size required | Elliptic curve size required |
| 80 bits | 1024 bits | 160 bits |
| 128 bits | 3072 bits | 256 bits |
| 256 bits | 15360 bits | 512 bits |
Tou Elliptic Curve Diffie-Hellman achieves strong security with more smaller key 😎 when compared to traditional DH.