Lesson Plan (Grades 9-12): Cryptography Code Quest

Hands-on cryptography unit where students code Caesar & Vigenère ciphers in Python, analyze patterns, and crack encrypted messages collaboratively.

Lesson Plan (Grades 9-12): Cryptography Code Quest

Lesson Title: Cryptography Code Quest

Grade Levels: 9–12

Subject Area: Mathematics (Number Theory) & Computer Science


1. Introduction

Cryptography has shaped history, from Julius Caesar’s simple shift cipher to the unbreakable codes of modern digital security. In Cryptography Code Quest, students immerse themselves in the art and science of secret messaging. Over multiple sessions, teams explore the mechanics behind the Caesar cipher, where each letter is shifted by a fixed amount, and the Vigenère cipher, which uses a repeating keyword to provide stronger encryption.

Learners first work by hand to encrypt and decrypt short messages, gaining an intuitive understanding of modular arithmetic, alphabet wrap-around, and key management. They then transition to writing Python programs that automate these ciphers, reinforcing programming fundamentals such as string manipulation, loops, and functions.

The climax of the unit is a high-stakes “spy network” escape challenge: sealed packets containing a cascade of ciphertexts await decryption, each message unlocking the next clue. Teams race against the clock to apply both manual techniques and Python scripts, leveraging frequency analysis and algorithmic thinking to crack codes and retrieve a final passphrase that opens the classroom “safe.” This immersive experience develops number-sense, computational fluency, collaborative problem-solving, and an appreciation for the power of mathematical algorithms in real-world security.


2. Learning Targets

By the end of this lesson, every student will be able to:

  • Explain Classic Cipher Mechanics Through hands-on practice, students will articulate how the Caesar cipher shifts letters by a constant offset and how the Vigenère cipher extends this by cycling through a keyword. They will demonstrate modular arithmetic in wrapping ‘Z’ to ‘A’ and understand the concept of key reuse.
  • Manually Encrypt & Decrypt Messages Students will perform letter-by-letter transformations for both ciphers on paper, handling uppercase/lowercase distinctions and non-alphabetic characters correctly. They will verify accuracy by reversing their procedures, decrypting peer messages to plaintext.
  • Implement Cipher Algorithms in Python Learners will write robust Python functions—caesar_encrypt(text, shift) and vigenere_encrypt(text, key)—alongside their corresponding decryption counterparts. They will handle edge cases such as punctuation, whitespace, and wrap-around conditions, employing loops, conditionals, and basic string methods.
  • Design & Execute Code-Breaking Strategies Using frequency analysis for Caesar ciphers and Kasiski examination or index-of-coincidence methods for Vigenère ciphertexts, students will crack provided messages. They will document their reasoning, illustrating how letter frequency and repeated n-grams reveal keys.
  • Create & Exchange Secret Messages After mastering decryption, each team will author original plaintext messages, choose appropriate ciphers and keys, encrypt their texts, and exchange ciphertexts. Peers will apply their cracking skills to reveal the hidden content, fostering a cycle of encryption and decryption that deepens conceptual understanding.
  • Succeed in the Spy Network Challenge In the final timed relay, teams collaborate to decode a series of encrypted clues. They will alternate between manual methods and Python scripts, culminating in the recovery of a master passphrase. Success requires seamless integration of mathematical insight, coding proficiency, and effective team communication.

3. Standards Alignment

This unit interweaves core mathematical practices, computer science principles, and real-world applications:

  • CCSS.MATH.CONTENT.HSN-VM.C.13 Recognize the role of modular arithmetic in number-theoretic algorithms. Students apply modulo 26 operations when computing letter shifts in the Caesar cipher.
  • CCSS.MATH.CONTENT.HSN-RN.A.2 Use properties of integer exponents and modular arithmetic when implementing repeated key indexing in the Vigenère cipher.
  • ISTE Standard 4 (Innovative Designer) Students create digital artifacts—Python scripts for encryption and decryption—refining them through iterative testing, debugging, and peer review.
  • ISTE Standard 5 (Computational Thinker) Learners break down the cryptography problem into manageable steps: mapping characters to numeric values, applying arithmetic transforms, and reconstructing text. They develop algorithmic solutions and evaluate their effectiveness.
  • MP.6 (Attend to Precision) Emphasis on exact string handling, careful index calculations, and off-by-one checks. Attention to detail ensures that each encrypted or decrypted message matches expected results, reinforcing the importance of precision in both math and coding contexts.

Aligning with both mathematical and computational standards, this lesson situates abstract theory in an engaging, applied framework that prepares students for advanced studies in cybersecurity and algorithmic thinking.