Teaching objectives
We all have secrets we want to protect. How? By encrypting our messages.
This lab takes secondary-school students through six historical ciphers — from Hebrew scholars to American telegraph operators — and ends with three real cryptographer missions that require a bit more time and effort, because the code must be broken using letter frequency analysis.
What you'll learn
Students come to understand that encryption is always a reversible mathematical operation, and that the security of a code depends on how many possible keys exist and whether letter frequencies give it away.
- Monoalphabetic substitution ciphers: Caesar (fixed shift, rotating disc + frequency histogram), Atbash (A↔Z, encrypting and decrypting are the same operation), Masonic Pigpen (each letter is the shape of its cell across 4 grids).
- Transposition ciphers: Spartan scytale (column slider that redistributes letters) and rail fence (zigzag over N rails, read row by row).
- Steganography: Bacon's cipher (1605) with a 5-bit binary code hidden in two typefaces.
- Vigenère (16th c.): a key that shifts at every position, operated by hand with a Caesar disc, and broken systematically using the Kasiski test (finding key length L) and 6 histogram wheels to tune each key letter.
- Combinatorics: counting possible keys in Caesar, Vigenère, and arbitrary substitution, and seeing why more keys aren't enough if frequencies are still exposed.
- Frequency-based cracking: matching frequent letters in the ciphertext with E, A, O in Spanish until the plaintext can be read.
- Three final missions (Caesar, Pigpen, Bacon) consolidate all the techniques.
Key mathematical ideas
- A monoalphabetic substitution cipher is a bijection from the alphabet to itself; applying it twice returns the original (an involution in Atbash).
- The Caesar shift is modular arithmetic: encrypt = add mod 26, decrypt = subtract mod 26.
- Transposition reorders letters without changing them; the key is the geometric shape of the arrangement (columns or zigzag rails).
- Bacon's code assigns each letter a 5-bit number (A=00000 … Z=11001): it is a fixed-length binary encoding.
- Vigenère = adding two alphabets position by position (mod 26); it defeats frequency analysis because each plaintext letter can be encrypted in 26 different ways.
- Kasiski test: repeated patterns in the ciphertext appear separated by multiples of L (key length), making it possible to estimate L and reduce Vigenère to L independent Caesar ciphers.
- The number of keys grows from 26 (Caesar) to 26^L (Vigenère of length L) to 26! ≈ 4 × 10^26 (arbitrary substitution); even so, 26! keys provide no protection if the language leaves a fingerprint in the frequencies.
Room-by-room contents
Room 1 · Welcome to the zoo
Presentation screen announcing the 6 exhibits of the zoo (historical ciphers) and the 3 final missions. The student reads the route map and gets their bearings before starting.
Student tasks
- Read the description of the route and move on to the first exhibit.
Room 2 · Caesar's disc
Interactive rotating disc that applies the Caesar cipher (fixed alphabet shift). It is accompanied by a letter-frequency histogram for Spanish to begin developing intuition for statistical analysis.
Student tasks
- Turn the disc ring to try different shifts.
- Type a text and observe how it is encrypted/decrypted.
- Use the Spanish letter-frequency histogram to decrypt the room's message.
Room 3 · Atbash: the alphabet reversed
Biblical Hebrew cipher (700 BC) where A↔Z, B↔Y, C↔X… The room highlights the unique property: encrypting and decrypting are exactly the same operation.
Student tasks
- Apply Atbash to a sample text and confirm that encrypting twice recovers the original.
- Answer the question about the cipher's symmetry.
Room 4 · The Spartan scytale
Cylindrical transposition cipher used in Sparta (450 BC): a leather strip wrapped around a staff. A slider lets the student change the number of columns and observe how the letters are rearranged.
Student tasks
- Move the columns slider to see how the text is ordered or scrambled.
- Find the number of columns that reconstructs the original message.
Room 5 · The rail fence
Zigzag transposition cipher (American telegraphs, 19th century): the message is written across N rails and read row by row, with each rail shown in a different colour.
Student tasks
- Encrypt a short text by choosing the number of rails.
- Decrypt a ciphertext by identifying the zigzag pattern.
Room 6 · Pigpen (pig pen cipher)
18th-century Masonic cipher: each letter is represented by the shape of a cell from one of four grids (two 3×3 grids and two crosses, with and without a dot). The student learns to read and write in the symbol alphabet.
Student tasks
- Identify the four grids and their letters.
- Decrypt a message written in Pigpen symbols.
Room 7 · Bacon: the invisible message
Francis Bacon (1605) encodes each letter as a 5-bit binary code (A=00000, Z=11001) and hides it in a carrier text using two typefaces (normal and bold). Steganography: concealing the existence of a message.
Student tasks
- Read a text with two fonts and extract the A/B bits to decode the hidden word.
- Understand the difference between cryptography and steganography.
Room 8 · Vigenère: the shifting key
Introduction to the Vigenère cipher (16th century): the shift is not fixed but follows a repeating keyword. The student encrypts and decrypts with the interactive tool and understands why it defeats frequency analysis.
Student tasks
- Enter a text and a short keyword; observe the resulting ciphertext.
- Decrypt a message knowing the keyword.
Room 9 · Vigenère by hand
The student must perform the Vigenère operation manually: 6 letters of plaintext and a 3-letter key, using a Caesar disc that shows the addition (encryption) and subtraction (decryption) for each shift.
Student tasks
- Use the Caesar disc to encrypt each letter by adding the corresponding key letter.
- Decrypt the text by subtracting the key letter by letter.
Room 10 · Vigenère without the key
Cryptanalysis scenario: a Vigenère message has been intercepted but the key is unknown. With a partial hint, the student tries candidate keys until the decryption produces readable text.
Student tasks
- Try candidate keys in the tool and assess whether the result makes sense.
- Find the correct key that decrypts the message.
Room 11 · Break Vigenère: how many wheels?
Kasiski-Babbage test: if the key has length L, positions that are a distance L apart share the same Caesar shift. The student splits the ciphertext into groups and compares histograms to find the value of L that makes each group look like Spanish.
Student tasks
- Vary the length L and observe how the histogram of each group changes.
- Identify the value of L at which the histograms match Spanish letter frequencies.
Room 12 · Vigenère: adjust the 6 wheels
Now that the key length (6) is known, the student turns each of the 6 wheels independently: turning a wheel shifts the corresponding group's histogram and the partial decryption updates in real time.
Student tasks
- Turn each wheel until its histogram matches the Spanish frequency profile.
- Read the fully decrypted message once all 6 wheels are in their correct position.
Room 13 · How many different codes are there?
Combinatorial reasoning about the key space: Caesar (25), 3-letter Vigenère (26³), arbitrary letter-to-letter substitution (26!). The room shows why key-space size alone does not guarantee security.
Student tasks
- Calculate or estimate the number of possible ciphers for each type.
- Reflect on why 26! keys does not prevent frequency-analysis attacks.
Room 14 · Break the substitution with frequencies
A long text encrypted by arbitrary substitution. The most frequent ciphertext letters appear in orange and the most frequent Spanish letters (E, A, O) in green. The student pairs them by clicking until the text becomes readable.
Student tasks
- Pair frequent ciphertext letters with the most probable Spanish letters.
- Adjust the pairs until the decrypted text is legible.
Room 15 · Mission 1: decrypt a Caesar
First final mission: a simple Caesar message that the student must decrypt by moving the slider until the text makes sense. Serves as a warm-up after the Vigenère block.
Student tasks
- Move the shift slider until readable text is obtained.
- Confirm the decryption to move on to the next mission.
Room 16 · Mission 2: the Masonic spy
Second mission: an intercepted note with 7 Pigpen symbols. The student uses the 4 grids as the key to decrypt the spy's message.
Student tasks
- Consult the four Pigpen grids.
- Translate each symbol to its letter and write the decrypted word.
Room 17 · Mission 3: the invisible ink
Third mission: an innocent-looking text hides a word in Bacon code using two typefaces. The student extracts the bit sequence and converts it to letters to reveal the hidden message.
Student tasks
- Identify the letters in normal typeface (A) and bold (B) in the carrier text.
- Group the bits in sets of 5 and convert them to letters using the Bacon table.
- Write the hidden word to complete the lab.
Rooms to project
The most striking ones to show and discuss in class.