Due Monday, September 11, 2023

1. On canvas (Media Gallery Tab), there’s a video called “BONUS VIDEO: 2023-09-08 (Diffie Hellman Key Exchange in Practice)”  Please watch this (~ 20 min) video.  In the video, I demonstrate how to use the course website tools (on this website) to put your Diffie-Hellman public key up on the discord server, and send a message to someone there.  Here are the written notes from that video.
2. Here are the full written instructions:  you will perform a Diffie-Hellman Key Exchange in order to send a message to someone.  Big picture:  you’ll do a Diffie-Hellman Key Exchange to make a shared secret and then use that shared secret as a key for a very simple encryption (a sort of Caesar Cipher or One-Time Pad):
1. Create a secret message which is at most 6 characters long.  It should answer “Why CU?”  Please don’t make it longer or this exercise won’t work.
2. Turn it into an integer using the Text to Integer tool.  (This turns it into an integer by writing the letters in ASCII and making an integer base 255 with those digits.  There’s an Integer-to-Text tool on the same page to undo this process.)
3. We will use prime $p=10^{15}+37$, and its primitive root $g=2$.  The first box in the Diffie-Hellman Tools page will initialize this modular ring for you.
4. Use the Diffie-Hellman Tools (second box) to find a random secret a.  We’ll call this your secret key.  Keep it secret, maybe in your underwear drawer. (Joking! — actually safer if you copy it into a text file on your computer, because if you write it by hand you’ll make an error.)
5. Compute $g^a$ using the Diffie-Hellman Tools third box (no need to do this by hand!) We’ll call this your public key.
6. Announce your public key on discord #public-keys.  Be sure to explain this is your “Diffie Hellman Public Key” (there will be other types later).
7. Find someone else’s public key ($g^b$) on discord (the most recent public key on the #public-keys channel is best, so everyone gets to have part of the fun).  Let’s call that other person Bob.  Use it to generate your shared secret ($g^{ab}$) with Bob (you’ll need your secret key for this).  Again, you can use the third box in the Diffie-Hellman Tools page to do the computations (no need to work by hand).
8. Add the shared secret to your message mod p.  Announce the result on discord in the #ciphertexts channel as the secret message for BobInclude your public key for them, because they will need it.  You post might look like “My Diffie-Hellman message for @soandso is X.”
9. When someone sends you a secret message, figure out how to decrypt it and announce the result (so you can check it worked!).  You may need to use the Diffie-Hellman Tools and the Text to Integer converter.
3. Please bring a device to class (laptop or ipad) that can use the course website Sage tools.  We will be doing some work together in class in groups.
4. Check out last day’s solutions:
1. The inverse of 7 mod 11 is 8, since 7*8 = 56 which is 1 more than 55.  One way to get Sage to compute this is Mod(7,11)^(-1).
2. The inverse of 7 mod 14 was a trick question!  It has no inverse, since 7 and 14 share a prime factor.
3. You can verify your euler phi functions by the Sage command euler_phi(26), which returns 12.  We have $\varphi(12)=4$, $\varphi(26)=12$, $\varphi(27) = 18$.
4. For the problems about $1, a, a^2, \ldots$, I essentially used/discussed this in lecture today, but feel free to ask more questions.
5. If you did some Hill Cipher problems on the last daily post, check out some exercises and solutions I’ve added to the overleaf notes, which included those problems.