Free Tool

Running Key Cipher Tool

A Vigenère cipher keyed by a page of a book

Ciphertext

How the Running Key cipher works

A running key cipher is a Vigenère cipher whose key is a long passage of text instead of a short repeating word. Because the key is as long as the message, there is no repetition for a codebreaker to measure.

  1. Pick a passage both sides have, such as the first page of a novel. Only its letters are used.
  2. Write the passage's letters under the message, one per letter. Spaces and punctuation in the message are kept and don't use up key letters.
  3. Shift each message letter by its key letter (A = 0, B = 1 … Z = 25). To decrypt, shift back.

The tool shows a warning if the key passage is shorter than the message. It still works, but the key repeats, and a repeating key is exactly what Vigenère-breaking tools look for.

Example

Using the opening of A Tale of Two Cities as the key, ATTACK AT DAWN becomes IMPAUD HX EEOG. The key letters under the message are ITWASTHEBEST.

How to break it

  • Drag a probable word. Subtract a common word such as THE or AND from the ciphertext at every position. Where it gives English-looking key letters, both guesses are probably right. Extend from there in both directions.
  • Both sides are English. Frequent pairs of plain and key letters (E with T, E with E, T with A …) are far more likely than rare ones, so a computer can score every possible split.
  • Find the book. Once a stretch of key is recovered, searching for it often finds the source text, and then the whole message falls.

History

Running keys taken from books were used from the 1800s into the 20th century. During the First World War, American cryptanalysts including William Friedman published methods for breaking them with probable words, which showed that a key made of language is never as safe as a random one.

Related tools

Questions

What text should I use as a running key?

Any passage both sides can find: a page of a book, a song, a famous speech. Agree on the exact starting point. The key must be at least as long as the message, or it starts repeating and becomes an ordinary Vigenère cipher.

Is a running key cipher unbreakable?

No. The key is ordinary English, so both the message and the key follow English letter patterns. Guessing common words in one reveals readable pieces of the other. Only a truly random key used once, a one-time pad, is unbreakable.

Is this the same as a book cipher?

They are related but different. A book cipher replaces words or letters with their positions in a book. A running key cipher uses the book's letters as a Vigenère key and keeps one cipher letter per plain letter.