Week 14 · Unit 7.3: Connections are made · 3 lessons
3
Secret messages
Computing 7: Unit 7.3, pp. 82–111
GoalExplain how encryption protects data and use Caesar and substitution ciphers on paper.
New words
encryption · scrambling data so that only the right device or person can read itplaintext · a message before it is encrypted, which anyone can readcipher text · the scrambled message after it is encryptedCaesar cipher · a cipher that moves every letter along the alphabet by the same number of places
Explanation
Encryption scrambles a message so that only the right person can read it. The original message is plaintext and the scrambled message is cipher text. A method, called an algorithm, and a secret key turn one into the other. In a Caesar cipher, each letter moves along the alphabet by the same number of places, and that number is the key. With shift 3, A becomes D, B becomes E, and Z wraps round to C. To decrypt, move each letter back by the shift. A substitution cipher swaps each letter for a different letter from a table, so the table is the key. Someone who intercepts the cipher text cannot read it without the key.
Worked examples
Encrypt SAFE with shift 3: S becomes V, A becomes D, F becomes I and E becomes H. The cipher text is VDIH.
Cipher text
K
H
O
S
back 3 places
H
E
L
P
Decrypt KHOS with shift 3. Move each letter back by 3: K goes back to H, H goes back to E, O to L and S to P. The plaintext is HELP.
plain
A
B
C
D
E
F
G
H
I
J
K
L
M
secret
Z
E
B
R
A
S
C
D
F
G
H
I
J
plain
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
secret
K
L
M
N
O
P
Q
T
U
V
W
X
Y
A substitution cipher uses a table. This table was made from the keyword ZEBRAS followed by the other letters. With it, BOOK becomes ELLH.
Class activity
Cipher strip (no computer): cut two strips of paper and write the alphabet on both, with equal spacing. Slide the lower strip three places to the left so that A sits under D. Use the strips to encrypt a short word, then ask a partner to decrypt it by sliding back. Next make a new key, shift 5, and write a message of three words. Swap with a partner and decode each other’s messages. Say why a stranger who finds the strip could read your messages, and what you would change to keep the key secret.
Practice
1
Encrypt the word BREAD with a Caesar shift of 5.
B→G, R→W, E→J, A→F, D→I. The cipher text is GWJFI.
2
Decrypt ICTFGP, which was encrypted with a Caesar shift of 2.
Move each letter back by 2: I→G, C→A, T→R, F→D, G→E, P→N. The plaintext is GARDEN.
3
This table is a different substitution key. Use it to decrypt LZBHL.
plain
A
B
C
D
E
F
G
H
I
J
K
L
M
secret
J
F
W
I
H
Y
O
T
Z
S
N
X
P
plain
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
secret
Q
A
G
V
L
D
R
C
B
U
M
E
K
Find each secret letter in a “secret” row and read the plain letter above it: L is R, Z is I, B is V, H is E, L is R. The plaintext is RIVER.
4
Why is a Caesar cipher easy to break, and why does a website using HTTPS need a much stronger method?
There are only 25 possible shifts, so someone can try them all in a few minutes. Real encryption uses far more complicated methods and very long keys, so that trying every possible key would take far too long, even for a computer.