Encryption and code-breaking – from the Caesar cipher to 128-bit keys
Computer ScienceDigital Safety & EthicsAges 15–16
Loading…
Sign in to playTurn a Caesar cipher wheel to encrypt and decrypt a sentence with a shift k. Break a secret message with frequency analysis by matching its letter-frequency chart to the typical frequencies of the language, for both a shift cipher and a substitution cipher. Then see how the key length in bits sets the number of keys and the brute-force time, and why HTTPS encrypts data in transit.
Lesson: Online safety: encryption, code-breaking and HTTPS
What it shows
A cipher turns readable plaintext into ciphertext using a key. The Caesar cipher shifts every letter k places, C = (P + k) mod 26, so there are only 25 useful keys and trying them all takes seconds. A substitution cipher scrambles the whole alphabet, giving about 4 × 10^26 keys, yet it still leaks letter frequencies, so frequency analysis breaks it. Modern ciphers such as AES hide those patterns, leaving brute force as the only general attack: each extra key bit doubles the work, which is why 128-bit keys and HTTPS keep data safe.
How to use
In Caesar wheel, drag the blue ring or use the Shift k slider, type a sentence and press Encrypt, Decrypt or Letter by letter. In Frequency attack, drag the orange profile or move Guess the shift until the peaks match, then tick Show the real key. Switch the cipher to Substitution and swap letters. In Key length and HTTPS, change Key length and Guessing speed, then compare HTTP with HTTPS.
Parameters you can change
- Starting tab Caesar wheel, Frequency attack, Key length and HTTPS
- Caesar shift k 1–25 places
- Cipher to break Shift (Caesar) cipher, Substitution cipher
- Key length 8–256 bits
- Guessing speed: 10 to the power x keys per second 3–18 x
Questions to explore
- Why can a Caesar cipher be broken quickly even when the key is unknown?
- How does adding one bit to a key change the time needed for a brute-force attack?
- On public Wi-Fi, what can an eavesdropper read when a website uses HTTP instead of HTTPS?