Assignment 1 – Due Thursday, August 31

In some of these problems you will need to convert characters to 8-bit bytes, and for that you should use ASCII codes. There are lots of good sources for this, but you can use https://ss64.com/ascii.html to find hexadecimal values and write that out in binary.

  1. Joe is developing a game in which a 3-character long animal name (characters as 8-bit ASCII values) is encrypted with a one-time pad. In testing, he puts in the plaintext string “COW” and the encryption algorithm outputs “ANT”. Joe is very concerned because he knows the output of encryption is supposed to look like random jibberish, not some animal name. Does this indicate that there’s something wrong with his code? Explain, and be very specific, giving exact values (24-bit values when needed!). Assuming he coded up the one-time pad properly, what is the probability of this happening?

  2. Textbook Exercise 1.7

  3. Textbook Exercise 1.12

  4. Extending Exercise 1.12, consider a situation where \(n=26\) and letters in a message are represented as numbers with \(A=0\), \(B=1\), …, \(Z=25\). If \(\texttt{KeyGen}\) picks \(k\leftarrow \{0,...,25\}\) then this is exactly what is described in Exercise 1.12, with \(n=26\).

    Consider if \(\texttt{KeyGen}\) instead picks from a smaller range: \(k\leftarrow\{0,...,12\}\). All operations are the same, so calculations are done mod 26. You eavesdrop on a game in which the encrypted message is a direction – either “EAST” or “WEST” – and see the ciphertext message \(\langle 9,7,0,0\rangle\). What is the plaintext message? Explain your work showing how you figured this out.

  5. Textbook Exercise 2.2, parts b and c (note that parts a and d are practice problems)

  6. Textbook exercise 2.4