From e328d6e77822d1c480f6da4d9c4c5247b307ecf3 Mon Sep 17 00:00:00 2001 From: Sonia Keys Date: Wed, 25 Jun 2014 00:12:17 -0400 Subject: [PATCH] new exercise diffie-hellman --- diffie-hellman.md | 29 +++++++++++++++++++++++++++++ diffie-hellman.yml | 4 ++++ 2 files changed, 33 insertions(+) create mode 100644 diffie-hellman.md create mode 100644 diffie-hellman.yml diff --git a/diffie-hellman.md b/diffie-hellman.md new file mode 100644 index 0000000000..98d6f1b396 --- /dev/null +++ b/diffie-hellman.md @@ -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. diff --git a/diffie-hellman.yml b/diffie-hellman.yml new file mode 100644 index 0000000000..43cebd86c3 --- /dev/null +++ b/diffie-hellman.yml @@ -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"