Diffie-Hellman Example
Here is an example of Diffie-Hellman using small numbers.
The eavesdropper monitors what is sent between the sender and the recipient, but does not alter the contents of their communications.
a = sender's private key
a = 3
b = recipient's private key
b = 4
g = public base
g = 1
p = public (prime) number
p = 5
s = shared secret key
s = 1
Sender
knows
does not know
p = 5
b = 4
base g = 2
a = 3
2
3
mod 5 = 3
2
b
mod 5 = 1
1
3
mod 5 = 1
3
b
mod 5 = 1
1
3
mod 5 = 3
b
mod 5
s = 1
Recipient
knows
does not know
p = 5
a = 3
base g = 2
b = 4
2
4
mod 5 = 1
2
a
mod 5 = 3
3
4
mod 5 = 1
1
a
mod 5 = 1
3
4
mod 5 = 1
a
mod 5
s = 1
Eavesdropper
knows
does not know
p = 5
a = 3
base g = 2
b = 4
s = 1
2
a
mod 5 = 3
2
b
mod 5 = 1
1
a
mod 5 = s
3
b
mod 5 = s
1
a
mod 5 = 3
b
mod 5
What is
RSA encryption
?
© 2006 John Michael Pierobon
Notes