Running Key Cipher - Online Encoder & Decoder Tool

The Running Key cipher is a Vigenere variant that uses a long passage of text, such as a book excerpt, as the encryption key. Instead of repeating a short keyword, the key stretches across the entire message, eliminating the cyclic patterns that make standard Vigenere vulnerable to frequency analysis. Use this free tool to encrypt and decrypt Running Key cipher messages using any text passage as your key.

Encrypt
0 characters
Result
0 characters

Settings

Frequently Asked Questions About Running Key Cipher

What is a running key cipher?

A running key cipher is a polyalphabetic substitution cipher that uses a long text passage (typically from a book) as its encryption key. Unlike the Vigenère cipher which uses a short repeating keyword, the running key cipher uses a key that is as long as the message, making it significantly harder to break through standard frequency analysis.

How does a running key cipher differ from a Vigenère cipher?

Both use a tabula recta for encryption, but they differ in key source. A Vigenère cipher uses a short keyword that repeats (e.g., 'SECRET'), while a running key cipher uses a long passage of text from a known source like a book. This means the running key never repeats within the message, eliminating the periodic patterns that Kasiski examination exploits.

Is a running key cipher the same as a book cipher?

No. A running key cipher uses book text as a key to encrypt each letter via the tabula recta, producing ciphertext letters. A book cipher uses the positions of words in a book (e.g., page-line-word numbers) to indicate plaintext words directly. The running key is a substitution cipher; the book cipher is a code system.

How do you break a running key cipher?

Running key ciphers are vulnerable to crib-dragging attacks. An analyst guesses a probable plaintext word, subtracts it from the ciphertext at every position, and checks if the resulting key text forms readable English. Since both the plaintext and key are natural language, valid decryptions produce English text in both streams simultaneously.

What makes a good running key?

A good running key should come from a widely available, specific text that both sender and receiver can access identically — such as a specific edition of a book, starting at an agreed page and line. The text should be prose (not poetry or lists) to avoid predictable patterns. Never reuse the same key passage for multiple messages.

Is the running key cipher secure?

The running key cipher offers moderate security but is not considered secure by modern standards. While it eliminates the periodic key repetition that weakens Vigenère, both the plaintext and key consist of natural language with predictable frequency distributions. Crib-dragging and statistical attacks can break it. For true security, use a one-time pad with truly random key material.

What is the relationship between running key cipher and one-time pad?

The one-time pad can be seen as a perfected running key cipher. If the running key text were truly random (not natural language), the system would be a one-time pad with mathematically proven unbreakability. The running key's vulnerability comes precisely from using predictable book text instead of random characters.

How to use the autokey cipher instead?

The autokey cipher is a related system where the plaintext itself becomes part of the key after an initial keyword. Try our Autokey Cipher tool at https://caesarcipher.org/ciphers/autokey for this variant. For the Vigenère cipher with a repeating keyword, use our Vigenère Cipher tool at https://caesarcipher.org/ciphers/vigenere.

Our running key cipher tool is a free online running key cipher encoder and decoder that uses long book texts as encryption keys. Unlike traditional ciphers with repeating keys, this running key cipher polyalphabetic substitution method employs entire book passages to create secure messages. Whether you're learning classical cryptography or need a practical running key cipher tool for book cipher encryption, our platform offers instant running key cipher encryption with visual demonstrations.

What Is the Running Key Cipher?

The running key cipher is a polyalphabetic substitution cipher that uses a long passage of text — typically from a book, document, or other published work — as its encryption key. Each letter of the plaintext is combined with the corresponding letter from the key text using the tabula recta (a 26x26 grid of shifted alphabets), producing a ciphertext letter.

The defining characteristic that separates the running key cipher from the standard Vigenère cipher is key length. While Vigenère uses a short keyword that repeats cyclically across the message, the running key uses a key that is at least as long as the plaintext itself. This eliminates the periodic repetition that makes Vigenère vulnerable to Kasiski examination and index-of-coincidence analysis.

Historically, correspondents would agree on a specific book, edition, page number, and starting line. This "indicator" allowed both parties to derive the identical key text without transmitting the key itself — only the book reference needed to be communicated, often disguised within seemingly innocent correspondence.

The running key cipher represents an important step in the evolution from simple polyalphabetic systems toward the theoretically unbreakable one-time pad. If the running key text were truly random rather than natural language, the system would achieve perfect secrecy.

How to Encrypt with a Running Key

The running key cipher encryption process uses the same mathematical formula as Vigenère: C[i] = (P[i] + K[i]) mod 26, where P is the plaintext letter, K is the key letter, and C is the resulting ciphertext letter. Each letter is mapped to a number (A=0, B=1, ... Z=25).

Step-by-step example using a passage from The C Programming Language by Kernighan and Ritchie as the running key:

  • Plaintext: ATTACK AT DAWN
  • Key text: A TUTORIAL INTRODUCTION (from Chapter 1 opening, letters only: ATUTORIALINTRODUCTION)
  • Process (letters only):
PositionPlaintextKeyCalculationCiphertext
1A (0)A (0)(0+0) mod 26 = 0A
2T (19)T (19)(19+19) mod 26 = 12M
3T (19)U (20)(19+20) mod 26 = 13N
4A (0)T (19)(0+19) mod 26 = 19T
5C (2)O (14)(2+14) mod 26 = 16Q
6K (10)R (17)(10+17) mod 26 = 1B
7A (0)I (8)(0+8) mod 26 = 8I
8T (19)A (0)(19+0) mod 26 = 19T
9D (3)L (11)(3+11) mod 26 = 14O
10A (0)I (8)(0+8) mod 26 = 8I
11W (22)N (13)(22+13) mod 26 = 9J
12N (13)T (19)(13+19) mod 26 = 6G
  • Result: ATTACKATDAWN → AMNTQBITOIJG

The key text must be at least as long as the plaintext. If spaces and punctuation are stripped from both texts before encryption, only alphabetic characters participate in the calculation.

How to Decrypt

Decryption reverses the encryption formula: P[i] = (C[i] - K[i] + 26) mod 26. The recipient must possess the exact same key text used for encryption.

Using the example above:

  • Ciphertext: AMNTQBITOIJG
  • Key text: ATUTORIALINTRODUCTION
  • First letter: A (0) - A (0) + 26 = 26, mod 26 = 0 → A
  • Second letter: M (12) - T (19) + 26 = 19, mod 26 = 19 → T
  • Continue for each letter to recover: ATTACKATDAWN

Both sender and receiver must agree on exactly how to extract key characters from the source text — whether to include spaces, punctuation, and how to handle uppercase versus lowercase. Any mismatch in key extraction will produce garbled plaintext.

Running Key vs Vigenère vs Autokey

The running key cipher belongs to a family of polyalphabetic ciphers that all use the tabula recta but differ in how they generate the keystream.

FeatureRunning KeyVigenèreAutokey
Key sourceBook passage or long textShort memorable keywordInitial keyword + plaintext
Key lengthAt least message lengthShort, repeats cyclicallyGrows with message
Key repetitionNever repeatsRepeats every N lettersDoes not repeat
Kasiski attackNot applicableHighly effectiveNot applicable
Crib-draggingPrimary attack methodNot neededPossible but harder
Key distributionAgree on book + positionShare a single wordShare initial keyword
Security levelModerateLowModerate
Historical useMilitary intelligenceDiplomatic messagesLimited adoption

The Vigenère cipher is the simplest: a short keyword like "SECRET" repeats to match the message length. The autokey cipher improves on this by appending the plaintext itself to the initial keyword, so the key never repeats. The running key cipher takes a different approach entirely by using an external text source as the key.

Running Key vs Book Cipher

Despite sometimes being used interchangeably in casual conversation, the running key cipher and the book cipher are fundamentally different systems:

  • Running key cipher: A substitution cipher that uses book text as a key to transform each plaintext letter via the tabula recta. The output is letters (or numbers representing letters). The key text and plaintext combine mathematically.

  • Book cipher: A code system that uses word positions within a book to represent plaintext words. The output consists of numbers indicating page, line, and word positions (e.g., "42-7-3" means page 42, line 7, word 3). No mathematical transformation occurs — the book is used as a codebook.

The running key cipher encrypts letter by letter, while the book cipher operates on whole words. Breaking the running key requires cryptanalysis; breaking the book cipher requires identifying the correct book. They serve different purposes and have different security properties.

Security Analysis

The running key cipher occupies a middle ground between the easily broken Vigenère cipher and the theoretically unbreakable one-time pad.

Crib-dragging attack: The primary weakness of the running key cipher is that both the plaintext and key consist of natural language. An attacker guesses a probable plaintext word (a "crib"), subtracts it from the ciphertext at every position, and checks whether the resulting key text forms readable English. Since English text has distinctive statistical properties, valid plaintext guesses produce recognizable key text — and vice versa. This attack was formalized by William Friedman in the early 20th century.

One-time pad connection: If the running key were truly random characters instead of book text, the cipher would become a one-time pad with mathematically proven perfect secrecy. The running key's vulnerability comes from the statistical predictability of natural language — common letter frequencies, digraph patterns, and word structures all leave detectable traces that a random key would not.

Practical defenses: Historical users improved security by choosing obscure texts (technical manuals, trade journals, yearbooks) rather than famous literature, by starting the key at unpredictable positions, and by never reusing the same key passage. Some practitioners applied additional encipherment layers on top of the running key output.

History

The running key cipher concept evolved from earlier polyalphabetic systems. The tabula recta itself was described by Johannes Trithemius in 1508, and Blaise de Vigenère expanded on the concept in 1586. However, the systematic use of long text passages as running keys developed later.

The French mathematician Arthur Joseph Hermann described the running key approach in 1892, formalizing the use of book text as a non-repeating polyalphabetic key. The method gained practical adoption in military and diplomatic communications during the late 19th and early 20th centuries.

William Friedman, often called the father of American cryptanalysis, developed systematic methods for attacking running key ciphers in the 1920s. His techniques, based on probable-word (crib) analysis and high-frequency digraph statistics, demonstrated that natural-language keys provided far less security than their length suggested. Friedman's work contributed directly to the theoretical foundations of the one-time pad, which Claude Shannon later proved mathematically unbreakable in 1949.

During World War II and the Cold War, running key ciphers saw limited military use because more secure systems (including the one-time pad and machine ciphers) were available. However, the running key remained popular among intelligence agents who needed a cipher that could be performed by hand without carrying suspicious equipment — only a commonly available book was required.

Explore these related polyalphabetic and classical cipher tools:

  • Autokey Cipher — Uses the plaintext itself as part of the key after an initial keyword
  • Vigenère Cipher — The classic polyalphabetic cipher with a repeating keyword
  • Beaufort Cipher — A reciprocal variant of the Vigenère cipher
  • Vernam Cipher — The one-time pad cipher with binary XOR operations
  • Caesar Cipher — The simplest substitution cipher using a single shift value