ST-Add the correct links to the Caesar files

Caesar Cipher


In this project you will learn about a simple message encryption method based on the “Caesar Cipher” and use Snap! to implement it.

If you have not covered Unit 2 Lab 6 Encryption Page 2: Secret Keys, it will be beneficial to read that page first. You may also want to look at the Snap! file linked here to get a feel what we are trying to build.

Here is the Wikipedia entry for a “Caesar Cipher”:

In cryptography, a Caesar cipher, also known as Caesar's cipher, the shift cipher, Caesar's code or Caesar shift, is one of the simplest and most widely known encryption techniques. It is a type of substitution cipher in which each letter in the plaintext is replaced by a letter some fixed number of positions down the alphabet. For example, with a left shift of 3, D would be replaced by A, E would become B, and so on. The method is named after Julius Caesar, who used it in his private correspondence.



In this project you will use a simplified version of the Caesar Cipher scheme where you will just will focus on the shifting of the alphabet. You will not have to worry about the alphabet wrapping around back on itself, such as X, Y, and Z mapping back to the start of the alphabet to A, B, and C, as shown in the above example. The Unicode key system employed by Snap! is vast so you can safely assume that any set of text characters to be encrypted will map to a set of printable characters, which may include characters such as : ; < = > ? @ ^ * { } ~.



Unicode is the computer industry standard for encoding and numerical representation of text characters. Access to the Unicode values in Snap! will be achieved by the following Operators blocks:


Example: Let’s say we are trying to encrypt “ABC123abc” with a Caesar Cipher. Both the sender (encrypting/encoding agent) and the receiver (decrypting/decoding agent) of the message will agree ahead of time on a “Shift Value”. Let’s say, this value is “4”. Then all the characters are shifted 4 to the right in the encryption. Thus “ABC123abc” when encrypted with a shift of 4 becomes “EFG567efg”.

A more complicated message such as: “Invasion of Normandy is on 6 June 1944”
encrypted in a Caesar Cipher with a shift 4, becomes: “Mrzewmsr$sj$Rsvqerh}$mw$sr$:$Nyri$5=88”
  1. With your partner encrypt and decrypt a simple message manually on your own using a Caesar Cipher to get a genuine feel for how this process works. Use the Unicode table given above as needed. Develop a simple algorithm for this procedure that works for any input text and given shift value.

  2. Try to code the simplified Caesar 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.

  3. You may be wondering how to extract the encrypted/decrypted messages from the Snap! interface. As the text output on the screen in Snap! is a graphic that cannot be copied and pasted, say, to an e-mail you wish to send a friend, you need a way to get a copy-able and paste-able version of this text. We can achieve this crucial step by right-clicking on the outputText variable and selecting the “Export” option which will download a text file to your computer which then you can copy/paste.



  4. Now put your work to the full test. Together with your partner decide ahead of time on a shift value for the Caesar Cipher encryption. Then use your Snap! Caesar Cipher to encrypt a secret message. Copy the encrypted message via the “Export” utility described above and paste it to an e-mail and send it to your partner. Then let your partner, use the agreed shift value and the Snap! Caesar Cipher to decrypt your secret message.


  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. Even though the Caesar Cipher can be a little challenging to implement, its main idea is quite simple and it is actually rather easy to break the code and decrypt a message written in this system. 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. Vigenere Cipher is one such famous example and has been used extensively in communicating sensitive information during combat such as during World War 2. Can you implement a Snap! version of a Vigenere Cipher?
  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!