CPSC 120 B




Lecture
MWF 10:50am - 11:50am
Lab
MWF 12:00pm - 1:00pm

Scotty Smith

Office
Trexler 365-B
Office Hours
Monday / Thursday
3:00pm - 5:00pm
Email
chssmithATroanoke.edu

< Back
Printable Copy

Lecture 27 - Test 2


This portion of the test is worth 30 total points. You may reference any files within your directory, as well as the Internet. As usual, you are not allowed to directly copy any code from the Internet or another individual without citation. You should also follow all coding standards discussed thus far.

Create a directory called test2 under cs120. Make sure all files you work on today are stored in this directory.

cd cs120
mkdir test2
cd test2

Question 10

Create a file called question_10.py. Put your answers to the following questions there.

(6 points each, 30 points total)


Bonus

Vigenère's Cipher

Vigenère's Cipher is very easy to understand, but is incredibly difficult to break. It took three centuries before anyone was able to break it. This earned its title: le chiffre indéchiffrable (the indecipherable cipher).

Vigenère's cipher is really just an extension of Caesar's Cipher. The main difference is the key that is used. In Caesar, the key is an integer representing the shift. Vigenère used letters to specify the shift. In fact, Vigenère's key is an entire word. The index of the letter in the Alphabet represents the shift performed using Caesar's cipher.

The added security comes from the fact that now each letter of the plain text is getting encrypted using different shift amounts, being specified by the key word. Consider the key "dawn". Using this key, you would encrypt the first letter of the plain text, performing Caesar with the key 3. Then, you would encrypt the second letter with the key 0. The third letter gets encrypted with the key 22. The fourth letter gets encrypted with the key 13. Then the cycle repeats: letter five uses the key 3, letter six uses the key 0, letter seven uses the key 22, and letter eight uses the key 13, and so on.

Create a file called bonus_question.py. In this file, write a function called encode_vigenere, which takes two parameters: plaintext and key, both strings. Your function should return a string, the Vigenère encoding of the plain text using the specified key.

(10 points)



Submission

When you have finished, create a tar file of your test2 directory. To create a tar file, execute the following commands:

cd ~/cs120
tar czvf test2.tgz test2/

To submit your activity, go to cseval.roanoke.edu. You should see an available assignment called Test 2.


Last modified: Mon Nov 4 09:45:47 EST 2013