Beaufort and Running Key Ciphers
Explore Vigenère variants including the Beaufort cipher and the theoretically unbreakable running key cipher.
Beaufort and Running Key Ciphers is a free Cryptology Academy lesson on CoddyKit — lesson 3 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Cryptology Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
The Beaufort Cipher
The Beaufort cipher is a variant of the Vigenère cipher with a key difference in the encryption formula. Where Vigenère computes C = (P + K) mod 26, Beaufort computes C = (K - P) mod 26.
This small change gives the Beaufort cipher a remarkable property: it is its own inverse. The same operation with the same key encrypts and decrypts, a property called being a reciprocal cipher.
Reciprocal Property of Beaufort
Because encryption and decryption are the same operation in Beaufort, the cipher is called "self-reciprocal" or "involutory". To decrypt, you run exactly the same procedure you used to encrypt.
This was practically useful in the pre-computer era: military operators only needed to learn one procedure instead of two separate encrypt and decrypt procedures, reducing training time and human error.
The Autokey Cipher
The autokey cipher addresses the key repetition weakness of Vigenère. The key starts with a short seed keyword, then appends the plaintext itself as the continuing key.
This means the key is as long as the message and never repeats. However, it is vulnerable to a clever attack: if you guess a plaintext word, you can test whether it appears as a key segment and confirm or reject guesses systematically.
Running Key Cipher Concept
The running key cipher takes the autokey idea further by using a long, pre-agreed text (such as a specific book) as the key. The key is as long as the message and comes from a seemingly random source.
Both sender and receiver must possess the same copy of the key text and agree on a starting position. The encryption is then identical to a Vigenère cipher but with a non-repeating key.
Why Running Key Is Theoretically Unbreakable
If the running key text is truly random (essentially a one-time pad), the running key cipher is information-theoretically secure. There is not enough information in the ciphertext to determine the plaintext without the key.
Claude Shannon proved this: for a cipher to be perfectly secret, the key entropy must be at least as large as the message entropy. A truly random key as long as the message satisfies this condition.
Practical Weakness of Running Key
In practice, book text is not random. It is English prose with all the statistical patterns of natural language. An attacker can try different books and starting positions, testing whether the derived key and plaintext both look like natural language.
This "two-text" property, where both plaintext and key must be valid language, paradoxically makes the running key cipher weaker in practice than a shorter but truly random key.
Bellaso and His Ciphers
Giovan Battista Bellaso published multiple polyalphabetic cipher designs in the 1550s. His work was later misattributed to Blaise de Vigenère, leading to the historical misnaming of the Vigenère cipher.
Bellaso's ciphers included a reciprocal variant that presaged the Beaufort cipher. His contribution to polyalphabetic cryptography was substantial, even though he received little credit until modern historical research corrected the record.
Polyalphabetic Ciphers and Index of Coincidence
Polyalphabetic ciphers use multiple substitution alphabets, rotating through them based on a key. This flattens the frequency distribution of ciphertext letters, making simple frequency analysis fail.
The Index of Coincidence (IC) measures how flat a frequency distribution is. English text has IC around 0.065. A perfectly random substitution has IC around 0.038. Polyalphabetic ciphers land between these values depending on key length.
The Friedman Test for Key Length
William Friedman developed a statistical test to determine the key length of a polyalphabetic cipher from ciphertext alone. By analyzing the IC of every nth character subset, he could identify the key period.
Once the period is known, the cipher reduces to multiple independent simple substitutions, each solvable by frequency analysis. This approach made Vigenère and Beaufort practically breakable.
The End of the Classical Cipher Era
By the early 20th century, every classical cipher from Caesar to Vigenère to Beaufort had been systematically broken using frequency analysis, the Kasiski test, or the Friedman IC method.
The arrival of mechanical ciphers (Enigma, SIGABA) and eventually computers fundamentally changed cryptography. Classical ciphers became historical curiosities and teaching tools rather than practical security mechanisms.
One-Time Pad: The Theoretically Perfect Cipher
The one-time pad, when used correctly, is the only provably perfect cipher. It requires a key that is truly random, as long as the message, used only once, and kept completely secret.
The running key cipher approximates this ideal but fails because natural language keys are not random. A true one-time pad with book text as key is vulnerable because both key and plaintext must be natural English, providing statistical leverage for cryptanalysis.
Beaufort Cipher Quiz
Test your knowledge of the Beaufort cipher and its properties.
Key Takeaways: Beaufort and Running Key
The Beaufort cipher is a self-reciprocal Vigenère variant where the same key and algorithm encrypt and decrypt. The running key cipher uses long text as a key, theoretically achieving perfect secrecy if the key is random.
In practice, natural language keys are exploitable. The Friedman IC test and Kasiski examination can determine key lengths of polyalphabetic ciphers, reducing them to solvable simple substitutions.
Frequently asked questions
Is the “Beaufort and Running Key Ciphers” lesson free?
Yes — the full text of “Beaufort and Running Key Ciphers” is free to read here on the web, and the Cryptology Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Cryptology Academy course, upgrade to CoddyKit PRO.
What will I learn in “Beaufort and Running Key Ciphers”?
Explore Vigenère variants including the Beaufort cipher and the theoretically unbreakable running key cipher. You practise Cryptology Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Cryptology Academy?
No prior experience is required. Cryptology Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 3 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Beaufort and Running Key Ciphers” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Cryptology Academy lesson?
Yes. Every Cryptology Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- The Playfair Cipher
- ADFGVX and Fractionation
- Beaufort and Running Key Ciphers
- Feistel Networks: Building Blocks of Modern Ciphers