Assignment 5 cns06 revised: 9/13/06 Assigned: 9/19/06 Due: 6:00pm 9/30/06 (use 594cns_submit to send program/answers to TA) Objective: classical crypto Points: 25 Description: 1. You are a lucky cryptanalyst -- you have access to the encrypting program so you can perform chosen-plaintext (and in two cases, chosen ciphertext) attacks on the encryptor. See if you can determine the encryption algorithm and key for the following. In your answer, also describe what techniques (text) were most useful in your mission and whether the encryptor is also the decryptor -- that is, if you type in the cipher text it produces do you get back the plaintext you originally typed in? Things to try the alphabet, strings of the same character, a's, z's, etc. If you can't figure out the key and algorithm, describe any interesting patterns you discover. a) telnet whisper.cs.utk.edu 7777 type in a line and it will encrypt it b) telnet whisper.cs.utk.edu 7778 type in a line and it will encrypt it (use ctrl-] quit to get out of telnet) c) run the program ~dunigan/cns06/blkbox on a linux box (e.g., cetus1). It will encrypt lines from stdin. Try various inputs to determine the algorithm and key. It is very similar to an algorithm in the book, what are any differences? Sometimes the cryptanalyst can find helpful information in other places. If you must :-), use clue 1: try nm ~dunigan/cns06/blkbox clue 2: try strings ~dunigan/cns06/blkbox In your ANSWERS, indicate if you had to use the clues. Even if you didn't use the clues, describe what info they provide. 2. View the strange text at the following URL http://www.cs.utk.edu/~dunigan/cns06/marstxt.gif Decrypt it. 3. Develop a C program to implement the 26x26 vigenere cipher. Your program should take two arguments, (1) whether to encrypt or decrypt and (2) a key. Your program will read lines from stdin and encrypt or decrypt them, writing the result to stdout. For example, vigenere e thisisakey will encrypt strings from stdin to stdout using the key vigenere d thisisakey will decrypt strings from stdin to stdout using the key Key and lines from stdin will not be longer than 127 characters. Convert lower case to upper case for both input and the key. Drop any non-alphabetic characters (including spaces) from input. Key should only be alphabetics. (A-Z, no spaces) Test your program to confirm that it decrypts what it encrypts. Confirm that the following test case works: key:bigdogs plaintext:computer science ciphertext:DWSSIZWSAILSTUF Try it with a key of all A's or all Z's and with input of various strings, including the alphabet. "paste" some of your tests into the ANSWERS file. Encrypt "roses are red" using the key "table" and include the encrypted output (cipher text) in your ANSWERS file. 4. Use your vigenere program to answer the following: Given the following ciphertext: COGMEIKQGRDAQXNBFFGCWCVDDNDBQEVTBDVULGHIEAB find the key that yields the following plaintext: (throw away the blanks) MR MUSTARD WITH THE CANDLESTICK IN THE HALL and find another key that yields the following plaintext: MISS SCARLET WITH THE KNIFE IN THE LIBRARY How does this problem relate to the unbreakability of the one-time pad? --------------------------------------------- Place the answers to the questions in a file named ANSWERS in a directory with your C source file and makefile (if any) and use 594cns_submit to submit your answers to the TA. See the class policy page for internal documentation requirements and such.