Want to keep learning?

This content is taken from the Davidson Institute of Science Education at the Weizmann Institute of Science's online course, An Introduction to Recreational Math: Fun, Games, and Puzzles. Join the course to learn more.
Secret code

Secret Codes

Secret codes are exciting! From the dawn of mankind to seconds ago, from scouts to intelligence agencies, everyone has been using them.

The mathematical study of secret codes is called Cryptography. Cryptography is a huge topic in math, with many day-to-day applications, that deserves its own fully fledged course, but it just wouldn’t be right giving an introductory course on recreational math without mentioning secret codes.

Two very brief classic secret codes.

A substitution cipher is a secret code where the letters in a message are replaced by another symbol with a one-to-one correspondence. The symbol may be another letter, or perhaps a number or some pictorial sign.

A transposition cipher is a secret code where we encode the entire message by scrambling up the order of the letters in the message.

Using statistics, it is usually easy to distinguish between transposition and substitution ciphers. The letter frequency of a message encrypted with a transposition cipher will be similar to the letter frequent of the language the message was written in. This is not true for substitution ciphers.

Secret code challenge

I would like to challenge you with two secret codes, one a transposition and the other a substitution code that I have made up and see if you can ‘break’ the codes. I’m just going to give you the secret messages, and you can ‘break’ them for yourselves. I also have a special request - make up your own secret code, post it in the comments below and let us all try and ‘break’ the codes.

Here are my two, both are nursery rhymes.

Message 1 - a transposition cipher:


HINT: First create an empty rectangular box 14x7. The message ends with three dots…

Message 2 - a substitution cipher:

Sph Omrk Gspi Aew e qivvc sph wsyp, Erh e qivvc sph wsyp aew li; Li geppih jsv lmw tmti, Erh li geppih jsv lmw fsap, Erh li geppih jsv lmw jmhhpivw xlvii!


Post your solutions to the secret messages in the comments below. Don’t forget to post your own secret code for us to try and break, and, most important, don’t peek at the answers before you crack the codes for yourself. Remember - honesty :-).

Good Luck!

Share this article:

This article is from the free online course:

An Introduction to Recreational Math: Fun, Games, and Puzzles

Davidson Institute of Science Education at the Weizmann Institute of Science