project05 - CSE 231, Fall 2007 Programming Project 05...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Programming Project 05 Assignment Overview This assignment is worth 40 points (4.0% of the course grade) and must be completed and turned in before 11:59pm on Monday, October 7, 2007 . The purpose of this project is to familiarize you with the use of lists and looping. For this assignment, you will create a decryption program. Background The Caesar cipher is named after Julius Caesar who used this type of encryption to keep his military communications secret. A Caesar cipher replaces each plain-text letter with one that is a fixed number of places down the alphabet. The plain-text is your original message; the cipher-text is the encrypted message. The example shown below is a shift of three so that “B” in the plain-text becomes “E” in the cipher-text, a “C” becomes “F”, and so on. The mapping wraps around so that “X” maps to “A” and so on. Here is the complete mapping for a shift of three: Plain: ABCDEFGHIJKLMNOPQRSTUVWXYZ Cipher: DEFGHIJKLMNOPQRSTUVWXYZABC To encrypt a message simply substitute the plain-text letters with the corresponding cipher-text letter. For example, here is an encryption of “the quick brown fox jumps over the lazy dog” using our shift-three cipher (case is ignored): Plaintext: the quick brown fox jumps over the lazy dog Ciphertext: WKH TXLFN EURZQ IRA MXPSV RYHU WKH ODCB GRJ To decrypt the message simply reverse the process. The encryption can also be represented using modular arithmetic after first transforming the letters into numbers according to the scheme: A = 0, B = 1, etc. (which is the index of the alphabet if it is in a string or a list). A shift-three cipher will take the number of each letter ( plainTextChar ), add 3 (the shift), and then find the remainder after dividing by 26 to get the cipherText: cipherTextChar = (plainTextChar + 3) % 26
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/19/2008 for the course CSE 231 taught by Professor Punch during the Fall '07 term at Michigan State University.

Page1 / 4

project05 - CSE 231, Fall 2007 Programming Project 05...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online