## Caesar Cipher Project

Use this source as a tool to assist you to encipher a short message.

A Caesar cipher (or shift cipher) is a simple encryption method. Each letter in what's called plaintext (the un-encrypted text) shifts some fixed number of positions along the alphabet. After Z, the shifting "wraps around" and goes back to A. For example, "ABCZ123abcz" shifted by 4 would become "EFGD567efgd". This technique is named after Gaius Julius Caesar, who ruled Rome 49-44 BC and used encryption in his correspondence.

In this project you will develop a program that uses a shift cipher that does not wrap around, but instead uses other characters like [ and { to follow Z and z.

1. Try out this example project and consider how you might design your own.

Internally, computers store keyboard characters (capital and small letters, punctuation marks, space, digits, symbols, and so on) and others (like Enter, or Command-Z, or Shift-Ctrl A) as numbers - binary sequences. The computer industry standard numbering is called Unicode. For most purposes, even programmers and web developers don't need to know what number represents what character, but sometimes we do need to specify a character by its number. This table shows the Unicode for some of the keyboard characters.

Unicode Table

 Code Char Code Char Code Char Code Char Code Char Code Char 32 (space) 48 0 64 @ 80 P 96 ' 112 p 33 ! 49 1 65 A 81 Q 97 a 113 q 34 " 50 2 66 B 82 R 98 b 114 r 35 ici 51 3 67 C 83 S 99 c 115 s 36 $52 4 68 D 84 T 100 d 116 t 37 % 53 5 69 E 85 U 101 e 117 u 38 & 54 6 70 F 86 V 102 f 118 v 39 ' 55 7 71 G 87 W 103 g 119 w 40 ( 56 8 72 H 88 X 104 h 120 x 41 ) 57 9 73 I 89 Y 105 i 121 y 42 * 58 : 74 J 90 Z 106 j 122 z 43 + 59 ; 75 K 91 [ 107 k 123 { 44 , 60 < 76 L 92 \ 108 1 124 I 45 - 61 = 77 M 93 ] 109 in 125 } 46 . 62 > 78 N 94 A 110 n 126 $\sim$ 47 / 63 ? 79 0 95 _ 111 o 127 (backspace) The unicode of block reports the number that is used for a particular character: The unicode as letter block reports the character that a given Unicode number represents: unicode (65) as letter reporting 'A' You can safely assume that shifting any set of text characters a reasonable distance will result in a set of printable characters, which may include non-alphanumeric (not letter or digit) characters like = ? @ # ^ * { ~. For example, if we use a shift of 4 to encrypt Invasion of Normandy is on 6 June 1944 it becomes: Mrzewmsr$sj$Rsvqerh}$mw$sr$:$Nyri$5=88

• Which character in ciphertext (the coded version) represents a space in the plaintext?
• In this code, 1 becomes 5, and 4 becomes 8, clearly showing the shift of 4. What does 9 become?

1. On paper, use a shift cipher to encrypt and decrypt a short message to get a feel for how this cipher works.
2. Develop an algorithm for this procedure that works for any input text and any shift value.
3. Try to code the shift cipher on your own in Snap! using the algorithm you have developed. If you get stuck, look at this page for hints on how to proceed.

4. You can extract the encrypted messages from the Snap! interface by right-clicking on the variable that holds the encrypted message and selecting the "Export" option which will download a text file to your computer which then you can copy/paste.

5. Now test your work. Agree with your partner on a shift value for the encryption. Then use your program to encrypt a secret message and e-mail it to your partner. Then let your partner, decrypt your message by using the program to reverse the shift.

1. Implement a version of the Caesar Cipher that not only shifts the characters but also wraps them round the alphabet when the end of the alphabet is reached. You may wish to restrict your alphabet to the set of printable characters given above in the Unicode table.
2. If you came across a long message encrypted in the Caesar Cipher but did not know the shift value, what are some ways you might be able to break the system and decrypt the message? Discuss the weaknesses of a Caesar Cipher and how it is prone to breaking.
3. Do some research on other types of ciphers used historically. Especially read about the Vigenere Cipher which was used extensively in communicating sensitive information during World War 2.
4. Watch the Oscar nominated movie "The Imitation Game" which tells the story of Alan Turing and his team of cryptographers who broke the Nazi encryption system "Enigma" based on the Vigenere Cipher. Research and discuss how this breakthrough ushered an era of research leading to the birth of modern Computer Science.
5. Do some research to learn about modern encryption systems such as the RSA cryptosystem employed to do secure transactions on the internet.
6. Create your own encryption/decryption scheme and implement it in Snap!.