The pigpen cipher (alternatively referred to as the masonic cipher, Freemason’s cipher, Rosicrucian cipher, Napoleon cipher, and tic-tac-toe cipher) is a geometric simple substitution cipher, which exchanges letters for symbols which are fragments of a grid.

The cipher is believed to be an ancient cipher and is said to have originated with the Hebrew rabbis. Thompson writes that, “there is evidence that suggests that the Knights Templar utilized a pig-pen cipher” during the Christian Crusades. Parrangan & Parrangan write that it was used by an individual, who may have been a Mason, “in the 16th century to save his personal notes.”

In 1531 Cornelius Agrippa described an early form of the Rosicrucian cipher, which he attributes to an existing Jewish Kabbalistic tradition.[12] This system, called “The Kabbalah of the Nine Chambers” by later authors, used the Hebrew alphabet rather than the Latin alphabet, and was used for religious symbolism rather than for any apparent cryptological purpose.[13]

On the 7th July 1730, a French Pirate named Olivier Levasseur threw out a scrap of paper written in the pigpen cipher, allegedly containing the whereabouts of his treasure which was never found but is speculated to be located in Seychelles. The exact configuration of the cipher has also not been determined, an example of using different letters in different sections to further complicate the cipher from its standard configuration.

Variations of this cipher were used by both the Rosicrucian brotherhood and the Freemasons, though the latter used the pigpen cipher so often that the system is frequently called the Freemason’s cipher. Hysin claims it was invented by Freemasons. They began using it in the early 18th century to keep their records of history and rites private, and for correspondence between lodge leaders. Tombstones of Freemasons can also be found which use the system as part of the engravings. One of the earliest stones in Trinity Church Cemetery in New York City, which opened in 1697, contains a cipher of this type which deciphers to “Remember death” (cf. “memento mori”).

George Washington’s army had documentation about the system, with a much more randomized form of the alphabet. During the American Civil War, the system was used by Union prisoners in Confederate prisons.

The Pigpen cipher offers little cryptographic security. It differentiates itself from other simple monoalphabetic substitution ciphers solely by its use of symbols rather than letters, the use of which fails to assist in curbing cryptanalysis. Additionally, the prominence and recognizability of the Pigpen leads to it being arguably worthless from a security standpoint. Knowledge of Pigpen is so ubiquitous that an interceptor might not need to actually break this cipher at all, but merely decipher it, in the same way that the intended recipient would.