Alice
Bob
Click play to see the maths behind Diffie-Hellman Key Exchange
P = 13, G = 6
P = 13, G = 6
a = 5
b = 4
A=6^5 mod 13
B=6^4 mod 13
A=2
B=9
K=5^9 mod 13
K=2^4 mod 13
K = 3
K = 3
Alice and Bob picks a large prime P and a number G, which is a primitive root modulo p.
Alice and Bob randomly generates a private key a/b
Alice and Bob will then calculate their public key using P,G and their private key
Alice and Bob send eachother their public key
Alice and Bob calculate the exchanged public key with their private key to get the solution
Alice and Bob end up with the same solution without having to share their privat key
Alice
Bob
Agree on a colour (p,g)
Both users will pick their own private colour that is different from the other persons. (This is the users Private key)
The users will then mix their private colour with the agreed colour (This is the users Public key)
Swap the mixed colours (Public Key) with thier partner
Mix the swapped colour (public Key) with their private colour (Private Key)
Both users will end up with the same colour without having to share their private colour
Click play to see Diffie-Hellman Key Exchange example from a practical example using paint mixing to symbolise the key exchange