We are going to build a Caesar Cipher using spreadsheet software. To make this easy, we need to understand a little bit about how the alphabet is stored on a computer using ASCII. ASCII stands for the American Standard Code for Information Interchange and was a system that was invented to store the alphabet in the language computers understand - Binary.
Task 1
Open spreadsheet software and write the alphabet vertically in one of the columns.
Find out the function to convert letters to ASCII and then use this to show the ASCII number in the column next to the letter.
Task 3
Once you complete Task 2, you will notice that sometimes the key causes strange characters to appear, like this:
Why do you think this happens?
Using an IF function try to solve this problem
Helpful Information on IF statements An IF function has three parts to it. 1. The test 2. What to do if true 3. What to do if false
For example: =if(1>2,"BIGGER","SMALLER") What word would appear on the screen here, BIGGER or SMALLER?
=if(5=5,"SAME","DIFFERENT") What about this one?
After watching the video you should understand that binary numbers can represent letters. As was explained, we look at the last 5 numbers and calculate the decimal number (base 10) to find out what letter we are looking for. So:
00001 = 1 = A 00010 = 2 = B 00011 = 3 = C
However, each letter is actually represented by 8 bits of data, not just 5. The first three bits tell us if we are looking at a uppercase letter or a lowercase letter. Uppercase letters start with 010 and lowercase letters start with 011. So:
01000001 = 65 = A 01100001 = 97 = a
Task 2
We can use this ASCII number along with a key (shift) to create a Caesar Cipher.
Create a cell to hold the key.
Find the function to convert ASCII number back to a letter
Use this function and the key to encrypt the letter
Task 4
Now you have the program built that is capable of encrypting a message using a Caesar Cipher. Can you now build a message on your screen and using what you have learnt, encrypt it?