kids encyclopedia robot

Substitution cipher facts for kids

Kids Encyclopedia Facts

A substitution cipher is a way of hiding messages by replacing each letter with a different one. It's like a secret code where 'A' might become 'T', 'B' might become 'H', and so on. This method is a basic form of cryptography, which is the study of secure communication.

Imagine you have a secret rule that tells you exactly which new letter to use for each original letter. For example, if your rule says 'A' becomes 'T', then every 'A' in your message would be swapped out for a 'T'.

Here's an example of a simple substitution rule:

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
T H A N K Y O U V E R M U Z X W S Q B C D F G I J L

Using this rule, the message "Jack and Jill went up the hill" would become "Etar tzn Evmm gkzc dw cuk uvmm". A famous type of substitution cipher is the Caesar cipher, where each letter is shifted a certain number of places down the alphabet.

How to Break Substitution Ciphers

Substitution ciphers are not very secure for important secrets. People can often figure them out using a trick called frequency analysis. This method looks at how often each letter appears in the hidden message.

Understanding Letter Frequency

In English, some letters are used much more often than others. For example, 'E' is the most common letter, followed by 'T', then 'A', and so on. Even when a message is hidden with a substitution cipher, the new letters will still show this pattern. The most common letter in the coded message is probably the letter that stands for 'E'.

This gives a big hint about the secret rule. Breaking these kinds of hidden messages, often called cryptograms, is a fun puzzle you might find in newspapers.

An Example of Breaking a Code

Let's look at a coded message and try to figure it out using frequency analysis.

Suppose the hidden message is: LIVITCSWPIYVEWHEVSRIQMXLEYVEOIEWHRXEXIPFEMVEWHKVSTYLXZIXLIKIIXPIJVSZEYPERRGERIM WQLMGLMXQERIWGPSRIHMXQEREKIETXMJTPRGEVEKEITREWHEXXLEXXMZITWAWSQWXSWEXTVEPMRXRSJ GSTVRIEYVIEXCVMUIMWERGMIWXMJMGCSMWXSJOMIQXLIVIQIVIXQSVSTWHKPEGARCSXRWIEVSWIIBXV IZMXFSJXLIKEGAEWHEPSWYSWIWIEVXLISXLIVXLIRGEPIRQIVIIBGIIHMWYPFLEVHEWHYPSRRFQMXLE PPXLIECCIEVEWGISJKTVWMRLIHYSPHXLIQIMYLXSJXLIMWRIGXQEROIVFVIZEVAEKPIEWHXEAMWYEPP XLMWYRMWXSGSWRMHIVEXMSWMGSTPHLEVHPFKPEZINTCMXIVJSVLMRSCMWMSWVIRCIGXMWYMXXLIYSPH KTY

We can count how many times each letter appears. We find that 'I' is the most common letter. In English, 'e' is the most common. So, we can guess that 'I' stands for 'e'.

Next, we notice that 'X' is also very common. The group of letters 'XLI' appears many times. The most common three-letter word in English is "the". This makes us guess that 'XLI' means "the". So, 'X' is 't', 'L' is 'h', and 'I' is 'e'.

Now we have some letters figured out:

  • I = e
  • X = t
  • L = h

Let's put these into the message. We'll use lowercase for the letters we've guessed and keep uppercase for the ones we haven't.

heVeTCSWPeYVaWHaVSReQMthaYVaOeaWHRtatePFaMVaWHKVSTYhtZetheKeetPeJVSZaYPaRRGaReM WQhMGhMtQaReWGPSReHMtQaRaKeaTtMJTPRGaVaKaeTRaWHatthattMZeTWAWSQWtSWatTVaPMRtRSJ GSTVReaYVeatCVMUeMWaRGMeWtMJMGCSMWtSJOMeQtheVeQeVetQSVSTWHKPaGARCStRWeaVSWeeBtV eZMtFSJtheKaGAaWHaPSWYSWeWeaVtheStheVtheRGaPeRQeVeeBGeeHMWYPFhaVHaWHYPSRRFQMtha PPtheaCCeaVaWGeSJKTVWMRheHYSPHtheQeMYhtSJtheMWReGtQaROeVFVeZaVAaKPeaWHtaAMWYaPP thMWYRMWtSGSWRMHeVatMSWMGSTPHhaVHPFKPaZeNTCMteVJSVhMRSCMWMSWVeRCeGtMWYMttheYSPH KTY

We can now make more guesses. For example, "heVe" might be "here". "Rtate" could be "state". And "atthattMZe" looks like "atthattime".

By continuing this process of guessing common letters and word patterns, we can slowly reveal the entire message. If a guess doesn't work out, we can go back and try a different one.

Eventually, the full message is revealed to be: hereuponlegrandarosewithagraveandstatelyairandbroughtmethebeetlefromaglasscasei nwhichitwasencloseditwasabeautifulscarabaeusandatthattimeunknowntonaturalistsof courseagreatprizeinascientificpointofviewthereweretworoundblackspotsnearoneextr emityofthebackandalongoneneartheotherthescaleswereexceedinglyhardandglossywitha lltheappearanceofburnishedgoldtheweightoftheinsectwasveryremarkableandtakingall thingsintoconsiderationicouldhardlyblamejupiterforhisopinionrespectingitthegold bug

When we add spaces and punctuation, it becomes clear: Here upon le grand arose with a grave and stately air and brought me the beetle from a glass case in which it was enclosed. It was a beautiful scarabaeus and at that time unknown to naturalists of course; a great prize in a scientific point of view. There were two round black spots near one extremity of the back and a long one near the other. The scales were exceedingly hard and glossy with all the appearance of burnished gold. The weight of the insect was very remarkable and taking all things into consideration I could hardly blame jupiter for his opinion respecting it. (The Gold-Bug)

This example comes from a famous story called "The Gold-Bug" by Edgar Allan Poe, where a character uses this exact method to solve a hidden message.

Images for kids

See also

Kids robot.svg In Spanish: Cifrado por sustitución para niños

kids search engine
Substitution cipher Facts for Kids. Kiddle Encyclopedia.