WillTeachMaths logo

WillTeachMaths

Thinking-first maths tools

Cryptography and number theory

Secret messages reveal why patterns matter.

This prototype introduces classical cryptography through Caesar and Vigenere ciphers, then uses frequency analysis to ask how a weak cipher can be attacked.

The aim is not modern security. It is mathematical curiosity: keys, shifts, structure, evidence and the joy of trying to break a pattern.

Cryptography lab

Hide a message, then look for the pattern that gives it away.

Classical ciphers are not secure today, but they are a brilliant way to see the mathematics of keys, frequency and structure.

Letters used

48

Cipher

Caesar

Key

7

Encrypted message

Thaolthapjz pz mbss vm whaalyuz dhpapun av il kpzjvclylk.

Grouped version

THAOL THAPJ ZPZMB SSVMW HAALY UZDHP APUNA VILKP ZJVCL YLK

Decrypting with the chosen key gives:

Mathematics is full of patterns waiting to be discovered.

Break the cipher

Frequency analysis looks for statistical fingerprints.

The green bars show the encrypted message. The grey bars show rough average frequencies in English. Short messages can be noisy, but longer messages often reveal useful clues.

A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
This messageTypical English

Caesar attack

Try every shift.

A Caesar cipher only has 26 possible shifts, so it can be broken by brute force. The table ranks shifts by how English-like the result appears.

Guided tasks

Encrypt a short message with a Caesar shift. Can someone guess the message without knowing the key?
Make the message much longer. What happens to the frequency graph?
Compare Caesar and Vigenere. Which one hides the frequency pattern better?
Explain why a cipher can be mathematically interesting even if it is not secure today.

Joy in the process

The point is not just to finish. It is to notice, test and return.

These tools are invitations to explore. A good mistake, a surprising pattern or a question you cannot yet answer is part of the work, not a failure of it.

The challenge is deliberate: the site should support thinking, not remove the need for it.

Before changing a setting, pause and predict what you think will happen.
Change one thing at a time. What stayed the same, and what changed?
Try to create a surprising case, a broken case, or a beautiful pattern.
Ask what this connects to outside the page: maps, movement, nature, systems or decisions.
Reset, then try again with a new question in mind.

Future extensions

This can become the first stop in a wider cryptography strand.

Add a substitution cipher mode where users build their own alphabet mapping.
Add a genuine cipher-breaking challenge with hidden messages and hints.
Add an explanation of modular arithmetic using letter positions.
Add a bridge into RSA and public-key cryptography.