Encryption: a Caesar cipher in Python – Year 9 Computing lesson
Pupils learn to encrypt and decrypt with a Caesar cipher by hand and write a Python function that encrypts a message with a given key.
Lesson 5 of 6 in unit 9.3 Cyber Security, taught in Year 9, Spring 1. It answers one big question: How does encryption keep a message confidential?
By the end, pupils can encrypt and decrypt with a Caesar cipher by hand and write a Python function that encrypts a message with a given key.
- The Build (the main task)
- Write a Python function encrypt(message, key) that uses a Caesar cipher to encrypt a message in capital letters, wrapping round from Z to A, then call it.
- Support version
- Parsons problem: the function's lines are jumbled, with one extra line that leaves out the wrap-round (% 26).
- Challenge
- Write decrypt(message, key), then explain why a Caesar cipher is too weak for real customer data.
- Real-world link
- Riverside Bike Fix sends customer details to its card company; today pupils see how encryption keeps them confidential and code the oldest cipher.
- Key words
- Encryption, Cipher and Confidential, each with a definition, an icon and a common mix-up on the key vocabulary slide.
- Misconceptions it tackles
- “Shifting a letter near the end of the alphabet goes off the end, so the cipher breaks”; “Encryption stops data from being intercepted”.
- National Curriculum
- NC9 (use technology safely, respectfully, responsibly and securely; report concerns); NC5 (hardware and software components and how they communicate with each other and other systems).
Every lesson follows the same Code & Commerce structure: a Bell Task recall starter, key vocabulary with definitions and icons, short teaching chunks with a check before pupils move on, The Build (one main task), challenge questions that get harder, and an exit question. Answers reveal one at a time on the slides, and everything is editable PowerPoint and Word.
Pupils need computers for the main task.
Also sold in the Cyber Security unit bundle, which includes the medium term plan, and in the full-year and complete-course bundles.
What's included
- Slide deck (PowerPoint)
- Lesson plan (Word)
- Worksheet (Word)
- Support worksheet with scaffolds (Word)
- Encryption - a Caesar cipher in Python - Quiz Quiz Trade Cards
- Single-teacher licence: use and adapt it with your own classes
More for KS3 Computing
See allPupils learn to identify personal data and explain which law – the DPA 2018 or the Computer Misuse Act 1990 – applies to a situation.
Free sample lessonPupils learn to identify the warning signs of a phishing message and explain how social engineering manipulates people.
Pupils learn to describe how five kinds of malware infect a computer and explain how anti-malware software and updates protect against them.
Written for the specifications named. Not endorsed by or affiliated with any exam board.