📁 Topic 3 · 3.4 Encryption
3.4 Encryption and ciphers
Edexcel 4CP0 · iGCSE Computer Science · ~14 min read
Notes
──
Video
──
Slides
──
Worksheet
──
Quiz

What is Encryption?

Encryption is the process of converting plaintext (readable data) into ciphertext (scrambled, unreadable data) using an algorithm and a key. Only someone with the correct key can decrypt it back to readable form. The Edexcel 4CP0 specification requires knowledge of four ciphers.

Caesar Cipher

The Caesar cipher is a substitution cipher where each letter in the plaintext is shifted a fixed number of positions along the alphabet. The shift amount is the key.

Example: Key = 3 (each letter shifted 3 places forward)

Plaintext: H E L L O
Shift +3: K H O O R
Ciphertext: KHOOR

To decrypt, shift back by 3:
K→H, H→E, O→L, O→L, R→O = HELLO

Weakness: Only 25 possible keys — easy to crack by brute force (trying all shifts).

Vigenère Cipher

The Vigenère cipher uses a keyword instead of a single shift. Each letter of the plaintext is shifted by the value of the corresponding letter in the keyword (repeated). This makes it much harder to crack than Caesar.

Example: Keyword = KEY, Plaintext = HELLO

Plaintext: H E L L O
Keyword: K E Y K E
Shift: +10 +4 +24 +10 +4
Ciphertext: R I J V S

(K=10, E=4, Y=24 — count from A=0). HELLO → RIJVS

Strength: The same letter can encrypt to different ciphertext letters (e.g. both L's above become different letters), making frequency analysis harder.

Pigpen Cipher

The Pigpen cipher is a substitution cipher that replaces each letter with a symbol based on a grid pattern. Letters are placed in two grids (a plain grid and a dotted grid), and the shape of the section containing the letter becomes the symbol.

  • First grid: A–I (nine cells, no dots)
  • Second grid: J–R (nine cells, with dots)
  • Two X patterns: S–V (no dots) and W–Z (with dots)

Each symbol looks like the portion of the grid surrounding the letter, with or without a dot. Used historically by Freemasons.

Rail Fence Cipher

The Rail Fence cipher is a transposition cipher — letters are rearranged rather than substituted. The plaintext is written diagonally across a number of "rails" (rows), then read off row by row to produce the ciphertext.

Example: 2 rails, Plaintext = HELLOWORLD

Rail 1: H . L . O . O . L .
Rail 2: . E . L . W . R . D

Rail 1 letters: H L O O L
Rail 2 letters: E L W R D
Ciphertext: H L O O L E L W R D = HLOOLELWRD

Cipher Comparison

CipherTypeKeyStrength
CaesarSubstitutionSingle shift (1–25)Very weak — only 25 keys
VigenèrePolyalphabetic substitutionKeywordStronger — multiple shifts
PigpenSubstitution (symbol)Fixed gridWeak — same letter always same symbol
Rail FenceTranspositionNumber of railsWeak — letters unchanged, just reordered
📝 Exam Tip: Know the difference between substitution (letters replaced by different letters/symbols) and transposition (letters rearranged). Caesar and Pigpen are substitution; Rail Fence is transposition. Vigenère is polyalphabetic substitution.
⚠️ Common Mistakes
  • Saying Rail Fence replaces letters — it only rearranges (transposes) them
  • Confusing Vigenère with Caesar — Vigenère uses a keyword (different shifts per letter); Caesar uses one fixed shift
  • Thinking Pigpen is unbreakable — it is a simple substitution cipher and easily broken with frequency analysis
← 3.3b Data Compression Topic 3 · 3.4 Encryption Next: Topic 4 – Computer Systems →
🔒
Pro Content
Subscribe to access all 47 Edexcel iGCSE lessons.
£7.99/month
or £59/year