CS461 MP 1: Due Wednesday 09/17 by 11:59 pm Fall 2014
\Anyone, from the most clueless amateur to the best cryptographer, can create an algorithm
that he himself can't break."
{ Bruce Schneier
Guidelines
You must work alone for this assignment.
You may use any programming language you're comfortable with, but we are using Python.
You're free to use any API or library you like. Don't re-invent the wheel.
Your answers might or might not be the same as your classmates'.
You must submit your answers in your SVN repository; we will only grade what's there!
Overview
This assignment will give you a chance to explore symmetric encryption.
Files
In your svn directory, you'll nd a folder called \mp1". The following les will be inside:
1. sub key.txt: key for task 1.
2. sub ciphertext.txt: ciphertext for task 1.
3. aes key.hex: key for task 2.
4. aes iv.hex: initialization vector for task 2.
5. aes ciphertext.hex: ciphertext for task 2.
6. aes weak ciphertext.hex: ciphertext for task 3.
7. key length.txt: a number needed for task 4.
8. bonus ciphertext.txt: ciphertext for a bonus mission, should you choose accept it.
We've also generated some (nearly) empty les for you to submit your answers to.
Tasks
1. Substitution Cipher (30 points)
2. Decrypting AES (30 points)
3. Breaking A Weak AES Key (30 points)
4. Computing Key Space Size (10 points)
5. Bonus: Breaking A Substitution Cipher (20 bonus points)
1CS461 MP 1: Due Wednesday 09/17 by 11:59 pm Fall 2014
1 Substitution Cipher
sub key.txt contains a permutation of the 26 upper-case letters that represents the key for
a substitution cipher. Using this key, the ith letter in the alphabet in the plaintext has been
replaced by the ith letter in sub key.txt to produce ciphertext in sub ciphertext.txt. For
example, if the rst three letters in your sub key.txt are ZDF..., then all As in the plaintext have
become Zs in the ciphertext, all Bs have become Ds, and all Cs have become Fs. The plaintext
we encrypted is a clue from the gameshow Jeopardy, and has only upper-case letters, numbers
and spaces. Numbers and spaces in the plaintext were not encrypted. They appear exactly as
they did in the plaintext.
Use sub key.txt to decrypt sub ciphertext.txt to obtain the plaintext and submit
it in sub plaintext.txt.
2 Decrypting AES
aes key.hex contains a 256-bit AES key represented as a series of hexadecimal values. aes iv.hex
contains a 128-bit Initialization Vector in a similar representation. We encrypted a Jeopardy
clue using AES in CBC mode with this key and IV and wrote the resulting ciphertext (also
stored in hexadecimal) in aes ciphertext.hex.
Decrypt the ciphertext and submit the plaintext in aes plaintext.txt.
3 Breaking A Weak AES Key
As with the last task, we encrypted a Jeopardy clue using 256-bit AES in CBC and stored the
result in hexadecimal in the le aes weak ciphertext.hex. For this task, though, we haven't
supplied the key. All we'll tell you about the key is that it is 256 bits long and its 251 most
signi cant (leftmost) bits are all 0's. The initialization vector was set to all 0s.
Find the plaintext and submit it in aes weak plaintext.txt.
4 Computing Key Space Size
Imagine a cipher you're working with takes a key with an unusual length. In key length.txt
you'll nd a single decimal (base 10) number representing how many bits the key has.
Calculate the total number of possible keys for this cipher (i.e. the size of the
key space), and submit your answer in key space size.txt as a single decimal num-
ber.
5 Bonus: Breaking A Substitution Cipher
For 20 bonus points, let's see if you can solve task 1 without the key. You can nd the cipher
text in bonus ciphertext.txt. The plaintext is guaranteed to consist of uppercase words in
English and spaces. As in task 1, spaces were not encrypted.
Submit the plaintext in bonus plaintext.txt.
2CS461 MP 1: Due Wednesday 09/17 by 11:59 pm Fall 2014
Final Checklist
Make sure you have submitted these les:
sub plaintext.txt
aes plaintext.txt
aes weak plaintext.txt
key space size.txt
(optional) bonus plaintext.txt
3