



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Project; Class: INTRO TO SYSTEMS SOFTWARE; Subject: Computer Science; University: University of Pittsburgh; Term: Summer 2008;
Typology: Study Guides, Projects, Research
1 / 7
This page cannot be seen from the preview
Don't miss anything!




Assigned: 05/28/
Due: 06/11/
Late Due Data (-15 pts): 06/13/
In this project, you will implement an extended version of the vigenere cipher (‘Xtreme vigenere or xvigenere). Besides the vigenere table substitution you will also add some rotation to the bits in the characters to further obscure the text.
The Vigenere cipher is a method of encrypting alphabetic text by using a series of substitutions based of a key. The cipher makes use of the classical Caesar Cipher that shifts each character in the plain text (unencrypted file) by a certain number and wraps around if the shift amount goes beyond 26 (Z). For instance, a Caesar cipher that uses a shift amount of 3 will turn A into D, B into E,…,X into A (wrap around), Y into B and Z into C. Consider the word “ATTACK” shifted by 3 letters each. The result will be:
DWWDGN.
Notice that in this case all the letters are shifted by the same amount! The Vigenere cipher complicates things just a little bit more, by shifting successive letters by different amounts. So basically, the Vigenere cipher is a sequence of Caesar ciphers with different shift amounts.
The vigenere cipher makes use of a keyword and the Vigenere tableau (Vigenere table). The letters in the keyword (key) are applied successively to the plaintext letters to create the cipher text (encrypted file). To determine the shift amount for a particular letter in the plain text , use the keyword letter to look up the corresponding cipher letter from the table. (Each letter in the key tells you how much to shift the plaintext letter by, A is 0 B is 1 C is 3 etc.) The Viegenre tableau is shown in figure 1 below.
Take the plaintext, ATTACK and the key BOOK.
To encrypt the plaintext take each character in turn and apply the corresponding key letter (wrapping around when the end of the key is reached).
A will use the key letter B to find its shift amount
T will use O, and so on
Plain text: ATTACK
Key: BOOK BO
To find the cipher text, look up A under B in the table (basically row A column B, and the value there is B; Row T column O results in I, etc)
Cipher text: BIIKDY
Each letter is shifted by the amount [key_letter#-1] wrapped around when the end is reached (think modulo ‘%’)
Figure 1
In the first part of the project, you will create a small program that generates a random key of a specified length.
3.2.1 Options
3.2.1.1 – e If the option on the command line is – e then the program should encode using key in the key file as follows:
3.2.1.2 – d If the option is – d then the reverse of the previous operation is performed (a cipher text file is decoded). Decode as follows:
3.2.2 Plaintext files All plaintext files will contain letters of the English alphabet, spaces and punctuations. There will be no other characters. You have to encode everything (including spaces and punctuations). There will be notnumbers (digits) in the test plaintext files.
The letters will be a mixture of uppercase and lowercase letters.
The files could be of any length (don’t make any assumptions as to the number of lines or the number of letters on a line). Keep reading and processing the file until the end of file is reached (EOF).
3.2.3 Keys Each key will be no more than 256 letters long. The keys will be made up of ONLY letters of the English alphabet.
Use the pseudorandom generator function rand() in the standard library (stdlib.h)
3.2.4 Rotation The rotation amounts will range between -8 and 8. If the rotation amount is positive then you should rotate the bits of the character to the right else rotate to the left. After rotation, the cipher text letters are going to be unreadable (binary characters). You may want to use unsigned char instead of char. (you will have to cast the EOF to unsigned char (unsigned char)EOF)
NOTE: The decoded file should be the same as the original!
There are sample plaintext files with their corresponding ciphertext files on the assignment page [www.cs.pitt.edu/~anti/cs0449/projects]
All work must be your own. You can discuss the project with your colleagues to gain some insights. Bu the final project should be YOUR OWN. Any student or group of students found to have shared code will receive a zero on this assignment.
You are not allowed to cannibalize code from the internet. You can search for ideas, but plagiarizing code from the internet is punishable by a zero score!
If you have any questions, please do not hesitate to inform the TA or the instructor, we’ll be glad to assist you.