Encryption and code-breaking – from the Caesar cipher to 128-bit keys
Computer ScienceDigital Safety & EthicsAges 15–16
How do you mainly use this simulation?
Use it with your class: students open it from a link or a QR code, with no account needed.
Turn a Caesar cipher wheel to encrypt and decrypt with a shift k, then break secret messages with frequency analysis for both shift and substitution ciphers. See how key length in bits sets the brute-force time and why HTTPS encrypts data in transit. In the Public key tab, build a toy RSA key pair, sign and verify a message, agree a key with Diffie–Hellman paint mixing and follow an HTTPS certificate check.
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 trying all 25 keys breaks it, and even a substitution cipher leaks letter frequencies. Modern ciphers such as AES leave only brute force, and each extra key bit doubles the work. Public-key cryptography solves the key-sharing problem: anyone encrypts with the public key, only the private key decrypts and signs, and Diffie–Hellman lets two people agree on a secret over an open network, as in HTTPS.
How to use
In Caesar wheel, drag the blue ring or use Shift k, then press Encrypt or Decrypt. In Frequency attack, move Guess the shift until the peaks match. In Key length and HTTPS, change Key length and Guessing speed. In Public key, pick Prime p and Prime q under RSA keys, press Sign and send and then Eve changes a letter, step through Key exchange with Next, and choose a Scenario under HTTPS certificates.
Parameters you can change
- Starting tab Caesar wheel, Frequency attack, Key length and HTTPS, Public key
- 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?