This preview shows page 1. Sign up to view the full content.
Unformatted text preview: PROJECT 3: Caesar Cipher INTRODUCTION Caesar’s Cipher was one of the first documented attempts to encrypt a message so that the enemies would not be able to get any information from it even if it got intercepted. Nowadays, encryption/decryption is far more sophisticated, however ideas like the Caesar cipher gave us the inspiration to look for further encryption. A few words about Caesar Cipher: if we are given a number of shifts towards the left, then we can shift our whole alphabet that way. For example, for #shifts=3, the alphabet would become: a b c d e f g h i j k l m n o p q r s t u v w x y z x y z a b c d e f g h i j k l m n o p q r s t u v w For another amount of shifts, the alphabet would change slightly according to the above rule. PROJECT DESCRIPTION You will have to implement the Caesar algorithm above, where the user will be prompted to decide how many shifts they want to make in their alphabets. The project will have the following 4 options: Option 1 Accept the input of the user. The user before they are able to use any other option should provide the software with the number of characters and the text they want to input. Assume that the input always comes from twitter and, hence, cannot be bigger than 140 characters. After option 1 has been selected, in order to modify the input, the user has to select yes when prompted to make sure that they want to change the already provided input. Option 2 Takes the input and encrypts it using as many shifts as the user specifies. Notice that in that case, option 1 must have happened in the past, otherwise option 2 5 will refuse to work. Option 3 Takes the input and decrypts it using again as many shifts as the user specifies. Option 4 Performs a statistical analysis of the given text. By that we mean that the frequencies of the letters appear (i.e. a appears 3 times, b appears 1 time and so on) and there is also a vowel to consonant ratio, which is the number of vowels divided by the number of consonants. Notice that for the VC ratio, you need to only count the characters in the alphabet and not other symbols (i.e., dots, commas, # and so on). NOTE: Assume that all input is always given in lowercase!! SAMPLE RUN Ceaser Cipher v2.0
1. To input/modify input data
2. To cipher a message
3. To decipher a message
4. To perform a statistical analysis of the text.
Press 0 to quit.
Please choose: 2
Please use option 1 before using this one.
Ceaser Cipher v2.0
1. To input/modify input data
2. To cipher a message
3. To decipher a message
4. To perform a statistical analysis of the text.
Press 0 to quit.
Please choose: 3
Please use option 1 before using this one.
Ceaser Cipher v2.0
1. To input/modify input data
2. To cipher a message
3. To decipher a message
4. To perform a statistical analysis of the text.
Press 0 to quit.
Please choose: 1
Give input count: 6
Please give text: hello.
Ceaser Cipher v2.0
1. To input/modify input data
2. To cipher a message
3. To decipher a message 4. To perform a statistical analysis of the text.
Press 0 to quit.
Please choose: 2
Please choose the number of shifts you want: 3
The encrypted message is: ebiil.
Ceaser Cipher v2.0
1. To input/modify input data
2. To cipher a message
3. To decipher a message
4. To perform a statistical analysis of the text.
Press 0 to quit.
Please choose: 4
Statistical Analysis
a: 0
b: 0
c: 0
d: 0
e: 1
f: 0
g: 0
h: 1
i: 0
j: 0
k: 0
l: 2
m: 0
n: 0
o: 1
p: 0
q: 0
r: 0
s: 0
t: 0
u: 0
v: 0
w: 0
x: 0
y: 0
The ratio of vowels to consonants is 0.4
Ceaser Cipher v2.0
1. To input/modify input data
2. To cipher a message
3. To decipher a message
4. To perform a statistical analysis of the text.
Press 0 to quit.
Please choose: 1
Are you sure you want to modify the input? r
Please choose Y(es) or N(o). Are you sure you want to modify the input? n
Returning to the main menu..
Ceaser Cipher v2.0
1. To input/modify input data
2. To cipher a message
3. To decipher a message
4. To perform a statistical analysis of the text.
Press 0 to quit.
Please choose: 1
Are you sure you want to modify the input? y
Give new input count: 6
Please give new text: ebiil.
Ceaser Cipher v2.0
1. To input/modify input data
2. To cipher a message
3. To decipher a message
4. To perform a statistical analysis of the text.
Press 0 to quit.
Please choose: 3
Please choose the number of shifts in the encrypted message: 3
The decrypted message is: hello.
Ceaser Cipher v2.0
1. To input/modify input data
2. To cipher a message
3. To decipher a message
4. To perform a statistical analysis of the text.
Press 0 to quit.
Please choose: 6
Wrong choice! Please choose again!
Ceaser Cipher v2.0
1. To input/modify input data
2. To cipher a message
3. To decipher a message
4. To perform a statistical analysis of the text.
Press 0 to quit.
Please choose: 0
Now quitting.. ...
View
Full
Document
 Fall '11
 Staff
 Computer Programming

Click to edit the document details