Introduction



https://en.wikipedia.org/wiki/File:CipherDisk2000.jpg#globalusage (Public domain)

Caesar commanded all of Rome's armies and won many battles that gave more land to Rome. How was he so successful as a leader? The key was his communication with his armies, which was encrypted so that his enemies could not decipher his battle plans 

Julius Caesar | Biography, Conquests, Facts, & Death | Britannica

(Sourcehttps://www.britannica.com/biography/Julius-Caesar-Roman-ruler#/media/1/88114/228404)

The Caesar Cipher

A cipher is a type of secret code, where you swap the letters around so that no-one can read your message. Hiding a word is called encryption. The Caesar cipher works by moving each letter in the plain text (uncoded message) up or down by a certain number of places in the alphabet (determined by the key). Can be modelled using a wheel.

The inner wheel will represent the new letter and the outer wheel will represent the original text. 

Caesar Cipher Disk 2.30 Apk Download - com.nb974.caesarcipherwheel APK free

(Sourcehttps://play.google.com/store/apps/details?id=com.nb974.caesarcipherwheel)

On this example, the key is 19, meaning that the inner circle has been moved 19 times to the left.

Encoding a message… 

Using the same wheel as the previous slide we will code the message “PYTHON PROJECT”.

Step 1: what is the key? (in this case 19)

Step 2: move the inner wheel that many places to the left (or right if the key is negative)

Step 3: now that the inner and outer wheel are lined up, for each letter of the plain text (“PYTHON PROJECT”), find the encoded equivalent (so “P” will change to “i”)

Step 4: do this for every letter

Caesar Cipher Disk 2.30 Apk Download - com.nb974.caesarcipherwheel APK free

Plain text: PYTHON PROJECT

Encoded message: irmahg ikhcxvm

 

Task



https://en.wikipedia.org/wiki/Caesar_cipher#/media/File:Caesar_cipher_left_shift_of_3.svg (public)

Create a program to encode messages using the Caesar Cipher while using Python.

Look at the video given in the right - How to use the Ceasar Cipher - and try to find out for what it could be used for. Also, look at the link about building the cipher see what there is easy or hard, interesting or is it boring? What could you use it for?

You will learn coding in Python language, and of course what is Ceasar Cipher and how it was/is used. Also how can it be used in Python?

Some of the Python commands are those of strings methods, creating and using of arrays and looping, also input and output and data types. Furthermore, you'll learn how to use basic and harder arithmetic operators. I nthis lesson you will not just be programmers or developers but also detectives too. Test your limits, your knowledge and intuition. 

You can create your own cipher about anything, but these examples are here to help you at first. 

Process

Before you start the lesson and creating a code, think about:

  • Do you know who was Caesar? Look up about his life, conquests and facts.  
  • Have you ever hear about the Caesar Cipher before. Look at the videos added in this lesson.
  • Discuss with your classmates, have they heard about this before and does it look easy to "make" or solve?

Try to make an encrypted message for your teacher or your classmate. Make a competition who makes the hardest one or the funniest one. 

This program should: 

  • Ask the user for a piece of plain text to be encrypted 
  • Ask the user for a key 
  • Encrypt the plain text using the key 
  • Output the encrypted message to the user

The process is described in the document called "Caesar Cipher" attached to this page (on the right side). The document consists of six (6) different steps and describes the Python commands needed to create the cipher.

  1. You need to start a Python IDE, or use Python online editor https://www.collegeofcoding.com/
  2. Attempt the Python code activity given on page 9 of Caesar Cipher.pdf
  3. Look and learn about input/output, date types, variables, loops and if-statements. 
  4. Test the printing command works by running the lines given.
  5. Follow the guide until step 6, and regularly test the program.
  6. On page 21 there is the final combined version of the code which you can use to compare against your code.

 

Conclusion

  • Now you should be able to cipher and do it in Python on anything.
  • You should be able to find material on your topic, and write the code.
  • You should know the basic about Caesar, the cipher and why and how it is used.

Next steps:

  • This is a good start for your own cipher creation.
  • Create your own and share it, make it hard but fun.
  • Move to Level 2 Python activity or try the Natural Disaster activity.

Links to everyday life:

  • Play - can be used to create secret messages between friends.
  • At work - cybersecurity and encryted network and messages.
  • Cooperation and communication - it helped Julius Caesar to win wars and revolutionise Rome.

Learning Objectives

Learning Objectives

  • You will be able to confidently declare variables with two different data types (integer and string)
  • You will be able to use input function to ask the user to enter the value of a variable
  • You will be able to use a for loop
  • You will be able to use an if statement
  • You will be able to use two string methods (accessing strings and find() function)
  • You will be able to know basic and some advanced arithmetic operators to calculate
  • You will be able to understand and be able to explain how a Caesar cipher works and the importance of the cipher

Resources

Click each section below to see all resources available.

Videos

How to Use the Caesar (Shift) Cipher
Fun Programming - Caesar cipher