Historical Ciphers

Discover Pigpen, Polybius, and Atbash ciphers from ancient times

← Previous: Math Puzzles Next: Block Ciphers →

Ciphers Through the Ages

Long before computers, people devised clever systems to hide messages using symbols, grids, and reversed alphabets. Three of the most famous historical ciphers — Pigpen, Polybius, and Atbash — are still studied today for their ingenuity and historical importance.

i

All three ciphers are monoalphabetic substitution ciphers — each plaintext letter always maps to the same ciphertext symbol, making them vulnerable to frequency analysis.

The Pigpen Cipher

The Pigpen cipher (also called the Masonic cipher or Freemason's cipher) encodes letters as geometric fragments of two grids. It was widely used by Freemasons in the 18th century to keep records private.

How It Works

Letters are placed into two grids and two X-shapes. Each letter's symbol is the portion of the grid cell that surrounds it, with a dot added for letters in the second set of shapes.

Grid 1 (A–I)

Grid 2 · dotted (J–R)

X-Grid 1 (S–V)

X-Grid 2 · dotted (W–Z)

Try the Pigpen Cipher

Encoded Result (symbols):

Historical Use

The Pigpen cipher was used by Freemasons as early as the 1700s to encode lodge records and correspondence. It also appeared in the American Civil War, used by Confederate soldiers in prisoner-of-war camps.

The Polybius Square

Invented by the Greek historian Polybius around 150 BC, this cipher converts each letter into a pair of numbers using a 5×5 grid. It was originally intended to allow messages to be transmitted using torches.

The Grid

Letters are arranged in a 5×5 grid (I and J share a cell). Each letter is replaced by its row number followed by its column number.

Example

H is at row 2, column 3 → 23

E is at row 1, column 5 → 15

HELLO → 23 15 31 31 34

Try the Polybius Square

Result:

Historical Use

Polybius designed the cipher for long-distance signalling — pairs of torches held up represented row and column numbers. The system was later adapted into the "tap code" used by prisoners of war in the 20th century to communicate through cell walls.

The Atbash Cipher

Atbash is one of the oldest known ciphers, originating in ancient Hebrew tradition around 500–600 BC. It simply reverses the alphabet: A↔Z, B↔Y, C↔X, and so on.

The Substitution Table

Example

Plaintext:  A B C D E ... X Y Z

Ciphertext: Z Y X W V ... C B A

HELLO → SVOOL

WORLD → DLIOW

i

Atbash is self-reciprocal: applying it twice returns the original text. Encrypting and decrypting use the exact same steps.

Try the Atbash Cipher

Result:

Apply it again on the result to get back the original!

Historical Use

Atbash was used in the Hebrew Bible to encode the name of Babylon (appearing as "Sheshach") in the Book of Jeremiah. The name "Atbash" itself comes from the first, last, second, and second-to-last letters of the Hebrew alphabet: Aleph–Tav–Beth–Shin.

Comparing the Three Ciphers

Cipher Origin Method Key Required? Security
Pigpen 18th century, Freemasons Symbol substitution via grid shapes No (standard grid) Very low
Polybius ~150 BC, Ancient Greece Letter → row/column number pair No (standard grid) Very low
Atbash ~600 BC, Ancient Hebrew Reverse alphabet substitution No (fixed) Very low

Summary

Key Points

  • Pigpen uses geometric shapes to represent letters; each symbol is a portion of its grid cell
  • Polybius converts letters into two-digit numbers based on a 5×5 grid
  • Atbash reverses the alphabet; it is its own inverse
  • All three are monoalphabetic — the same plaintext letter always becomes the same ciphertext symbol
  • None of these ciphers require a key, making them easy to use but very easy to crack
  • They laid the conceptual groundwork for more sophisticated substitution ciphers