Open the app
  1. Home
  2. Lessons
  3. GCSE & IGCSE Computer Science
  4. Encryption and classic ciphers

Encryption and classic ciphers

🎬 The doodle video for this lesson is coming soon. Subscribe on YouTube to see it first.

Encryption keeps messages secret even if they are intercepted. Classic ciphers show the key ideas used by modern encryption.

Why encrypt?

Data sent over networks can be intercepted. Encryption turns readable plaintext into unreadable ciphertext using an algorithm and a key.
Only someone with the key can decrypt it back to plaintext.

Caesar and Vigenère

Caesar cipher: shift every letter the same number of places. With a shift of 3, A becomes D and HELLO becomes KHOOR. Z wraps round to C.
It is weak: there are only 25 possible shifts to try.
Vigenère cipher: a keyword sets a different shift for each letter (A = 0, B = 1, C = 2 ...). The keyword repeats along the message.
Key LEMON on ATTACK: A+L = L, T+E = X, T+M = F ... giving LXFOPV.

Rail Fence and Pigpen

Rail Fence: write the message in a zigzag across a number of rows (rails), then read each row in turn.
With 2 rails, HELLOWORLD becomes HLOOLELWRD.
Pigpen: each letter is swapped for a symbol made from the part of a grid it sits in (two noughts-and-crosses grids and two X shapes, with and without dots).
Worked example

Encrypt CAB with a Caesar shift of 4.

  1. C + 4 = G
  2. A + 4 = E
  3. B + 4 = F

Answer: GEF

Key idea

Encryption turns plaintext into ciphertext with a key. Caesar shifts every letter equally; Vigenère uses a keyword for changing shifts; Rail Fence rearranges letters in a zigzag; Pigpen replaces letters with grid symbols.

Check you have got it

Answer 7 quick questions with instant marking. If you get one wrong, GCSE-ready shows you why and gives you another go. It is free, and you do not need an account.