Diffie-Hellman
What is the Diffie-Hellman Key Exchange?
Diffie-Hellman Key Exchange is a groundbreaking cryptographic method that allows two parties to securely generate a shared secret key over an insecure communication channel without prior shared knowledge. It was the first publicly described method for establishing a shared secret key through an unsecured medium.
Key Components:
1. Public prime number (p)
2. Public primitive root/generator (g)
3. Private random numbers
4. Public exchanged values
5. Modular exponentiation
Core Process:
1. Choose public prime p and generator g
2. Each party selects a secret random number
3. Compute and exchange public values
4. Use received value and private number
5. Both parties derive same secret key
Mathematical Steps:
Alice's Process:
• Choose secret number a
• Compute A = g^a mod p
• Send A publicly
Bob's Process:
• Choose secret number b
• Compute B = g^b mod p
• Send B publicly
Shared Secret Calculation:
• Alice: (B^a) mod p
• Bob: (A^b) mod p
• Both results identical: g^(ab) mod p
Example Scenario:
Public prime p = 23
Generator g = 5
Alice's secret: a = 6
Bob's secret: b = 15
Calculations:
• Alice: A = 5^6 mod 23 = 8
• Bob: B = 5^15 mod 23 = 19
• Shared Secret: 8^15 mod 23 = 19^6 mod 23 = 2