forked from exercism/ruby
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
Alice and Bob use Diffie-Hellman key exchange to share secrets. They start with prime numbers, pick private keys, generate and share public keys, and then generate a shared secret key. | ||
|
||
## Step 0 | ||
|
||
The test program supplies prime numbers p and g. | ||
|
||
## Step 1 | ||
|
||
Alice picks a private key, a, greater than 1 and less than p. Bob does the same to pick a private key b. | ||
|
||
## Step 2 | ||
|
||
Alice calcuates a public key A. | ||
|
||
A = g**a mod p | ||
|
||
Using the same p and g, Bob similarly calculates a public key B from his private key b. | ||
|
||
## Step 3 | ||
|
||
Alice and Bob exchange public keys. Alice calculates secret key s. | ||
|
||
s = B**a mod p | ||
|
||
Bob calculates | ||
|
||
s = A**b mod p | ||
|
||
The calculations produce the same result! Alice and Bob now share secret s. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
blurb: "Diffie-Hellman key exchange." | ||
source: "Wikipedia, 1024 bit key from www.cryptopp.com/wiki." | ||
source_url: "http://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange" |