Welcome to our next lesson! In our previous explorations, we've moved from the simple reversal of the Atbash cipher to the systematic shift of the Caesar cipher. You've seen that the Caesar cipher's strength comes from its key—a single number that determines the shift. But what if the substitution wasn't so orderly? What if, instead of shifting the alphabet, we simply scrambled it completely?
Today, we will generalize from the specific case of the Caesar cipher to its broader family: the monoalphabetic substitution cipher. Your goal is to understand what this type of cipher is, how its key is constructed, and why, despite having an astronomical number of possible keys, it contains a fatal flaw that was discovered over a thousand years ago.
Beyond the Shift: A Jumbled Alphabet
The ciphers we've studied so far—Atbash and Caesar—are both examples of monoalphabetic substitution ciphers. The name sounds complex, but the idea is simple:
- Monoalphabetic: "Mono" means "one." This tells us that a single, consistent ciphertext alphabet is used for the entire message.
- Substitution: This tells us that each letter in the plaintext is replaced by a corresponding letter in the ciphertext alphabet.
The SciShow video below provides a quick, clear definition of this concept.
The Science of Codes: An Intro to Cryptography
This video from SciShow offers a concise explanation of monoalphabetic ciphers.
Watch the short segment that defines this class of ciphers, from the beginning of the explanation. The key idea is that "one letter of the alphabet [is] standing in for another letter consistently."
In a Caesar cipher, the ciphertext alphabet is simply the plaintext alphabet shifted by a certain number of places. The key is that shift value (e.g., 3). In a general monoalphabetic substitution cipher, the ciphertext alphabet is a completely jumbled permutation of the plaintext alphabet.
The key is no longer a single number; it's the entire scrambled alphabet. For a more formal look at this, let's turn to a university-level resource.
Monoalphabetic Substitution Ciphers (MASCs)
This document provides a precise definition and a clear example of a monoalphabetic substitution cipher (MASC) key.
Read the first page of the document. Start from the definition of a MASC and examine the example key provided. This will show you exactly what a jumbled-alphabet key looks like and how it's used to encrypt a message.
A Practical Key: The Keyword Method
Agreeing on a 26-letter jumbled alphabet and writing it down without errors can be tricky. A much more elegant and memorable method is to use a keyword to generate the cipher alphabet. The sender and receiver just need to agree on one secret word.
The process is straightforward:
- Choose a keyword, for example,
KEYWORD. - Write down the keyword, removing any repeated letters.
KEYWORDhas no repeats, so we use the whole word. If the keyword wereCRYPTOGRAPHY, we would useCRYPTOAH(removing the second R, O, and P). - Write the remaining letters of the alphabet in their usual order after the keyword.
So, with the keyword KEYWORD, the cipher alphabet becomes:KEYWORDABCFGHIJLMNPQSTUVXZ
Now, you have your full substitution mapping:
Plain: ABCDEFGHIJKLMNOPQRSTUVWXYZ
Cipher: KEYWORDABCFGHIJLMNPQSTUVXZ
This means A becomes K, B becomes E, C becomes Y, and so on. This video explains the keyword method and its historical context.
Secret Codes: A History of Cryptography (Part 1)
This video from The Generalist Papers explains how a keyword can be used to generate a cipher alphabet, making it easier for the sender and receiver to remember the key.
Watch the section from "one solution to this problem". It walks through how to construct a cipher alphabet using a keyword.
The image below provides a great visualization of this exact process.

An Unbreakable Cipher? The Power of 26!
The Caesar cipher had only 25 useful keys. This makes it easy to "brute-force"—an attacker could simply try all 25 shifts until the message made sense.
How many keys does a general monoalphabetic cipher have?
- For the letter 'A', you have 26 choices for its substitute.
- Once you've chosen a substitute for 'A', you have 25 choices left for 'B'.
- Then 24 choices for 'C', and so on, until you have only 1 choice left for 'Z'.
The total number of possible keys is , which is known as "26 factorial" and written as 26!.
This number is astronomically large:
That's over 403 septillion possible keys. This enormous key space makes a brute-force attack completely impossible, even for the world's most powerful supercomputers. This might lead you to believe the cipher is unbreakable. However, as we'll see, this faith in large numbers can be misleading.
Monoalphabetic Substitution Ciphers (MASCs)
This section of the document you read earlier discusses the massive key space of MASCs and explains why a brute-force attack is not feasible. It includes a fantastic quote from historian David Kahn that puts the big number in perspective.
Read the sections titled Brute Force and Discovering Patterns. Pay close attention to the calculation of 26! and the argument about why, despite this huge number, these ciphers can be solved in minutes.
The Achilles' Heel: Frequency Analysis
As the reading hinted, monoalphabetic ciphers have a devastating weakness. While the key hides the letters, it doesn't hide the patterns of the language. Every time the letter 'E' appears in the plaintext, it is replaced by the exact same ciphertext letter.
This means the ciphertext letters inherit the frequency characteristics of the plaintext letters they replace. In English, 'E' is the most common letter, followed by 'T', 'A', 'O', and so on. If you encrypt a long English message, the most common letter in the ciphertext is very likely the substitute for 'E'.
This method of attack is called frequency analysis. It was discovered in the 9th century by the Arab philosopher and mathematician Al-Kindi, who effectively rendered this entire class of ciphers insecure for anyone who knew the trick.
This final video segment explains Al-Kindi's brilliant discovery and his method, which remains the primary way to crack these ciphers today.
Secret Codes: A History of Cryptography (Part 1)
This part of the video you watched earlier details the discovery of frequency analysis during the Islamic Golden Age and explains how it works.
Watch the section from "that is until the 8th century". It contains a remarkable quote from Al-Kindi's original text, explaining his technique in his own words. This is the logical key to unlocking these "unbreakable" ciphers.
Conclusion
In this lesson, we've generalized the simple shift of the Caesar cipher into the vast world of monoalphabetic substitution ciphers. You've seen that these ciphers are defined not by a simple rule, but by a completely jumbled alphabet that serves as the key.
Key Takeaways:
- A monoalphabetic substitution cipher uses one fixed, scrambled alphabet to substitute letters.
- The key is the entire scrambled ciphertext alphabet, which can be conveniently generated using a keyword.
- The number of possible keys is 26!, an enormous number that makes the cipher immune to brute-force attacks.
- However, the cipher's fatal flaw is that it preserves the statistical patterns of the language, leaving it vulnerable to frequency analysis.
The weakness of this cipher is so significant that it will be the focus of an entire future module where you'll get to try breaking one yourself.
Preview of the Next Lesson:
We've seen that some ciphers, like Caesar's, are elegantly described by mathematics, while others, like the general monoalphabetic cipher, seem less so due to their jumbled keys. However, the study of cryptography is deeply intertwined with mathematics. To prepare for the more advanced and powerful ciphers to come, our next module will focus on building up our mathematical toolkit. We'll begin by taking a deeper, more formal look at the concept of modular arithmetic, which you first saw with the Caesar cipher.