Created
December 26, 2019 23:49
-
-
Save nealfennimore/373fb3c1586b263a84f22a1a689331df to your computer and use it in GitHub Desktop.
Diffie-Hellman Key Exchange
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- Step 1 - exchanged common values | |
Initial common values: | |
p = 13 (prime number) | |
g = 7 | |
--- Step 2 - Each user creates own secret number | |
Alice secret number: | |
a = 5 | |
Bob secret number: | |
b = 8 | |
Computed secret for Alice: | |
A = g^a mod p | |
A = 7^5 mod 13 | |
A = 11 | |
Computed secret for Bob: | |
B = g^a mod p | |
B = 7^5 mod 13 | |
B = 3 | |
--- Step 3 - Exchange computed secret to other user | |
Alice shared secret is: | |
S1 = B^a mod p | |
S1 = 3^5 mod 13 | |
S1 = 9 | |
Bob shared secret is: | |
S2 = A^b mod p | |
S2 = 11^8 mod 13 | |
S2 = 9 | |
--- Step 4 - Use symmetric key for encrypting | |
Symmetric key is established: | |
S1 = S2 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment