Extended Pigpen Cipher to Include Numbers

Support this website by purchasing prints of my photographs! Check them out here.

The Pigpen Cipher, also sometimes called the Freemason's cipher, is a very simple substitution cipher. The thing that I like most about it is that one can easily remember how the pattern is drawn and, if ever in a jam, can easily recreate the cipher with a pencil and paper. Personally, I've memorized it and can recreate each individual symbol without the need to sketch out the diagram.

The way the cipher works is that you draw out a three by three square with just the internal lines, not the outside lines of the square, like an octothorpe symbol (#). Next to that you would ordinarily write out a large (X) symbol. After that you draw the same two shapes again, but this time there is a correlating large dot symbol ().

Once the symbols have been drawn out you then go through and add a letter inside each of the blank cells, starting from the upper left and going to the lower right. Finally, when you want to write out a letter that you don't want someone to read without knowing the cipher, you simply recreate the lines that surround the symbol. For example, the letter E is a basic square (), as it has a line on the top, bottom, left, and right. The letter R is a square with a circle inside of it (kind of like the symbol), as it also has a line on all sides but is in the second set with a black dot. The letter L is kind of like an arrow pointing left, or a triangle that meets on the left but is open on the right ().

This cipher is fun but one of the important things that it lacks is the ability to represent numbers.

Here is a solution that I invented that is backwards compatible with the Pigpen cipher, meaning that messages written in the Pigpen cipher still work, but additional symbols have been added to represent numbers:

Extended Pigpen, includes numbers, backwards compatible
Extended Pigpen, includes numbers, backwards compatible

This solution is rather elegant since the (X) symbols has simply been expanded into a rotated (#) symbol. This expansion conveniently adds exactly 5 slots to each X, resulting in the perfect space to add 10 numbers. Like the original it is still easy to memorize and recreate the symbols. By being backwards compatible each letter can still be decoded using the original Pigpen cipher.

And finally, what does this look like when written out? Here's the title of a book you might be familiar with, "Farenheit 451", written with the Extended Pigpen Cipher:

"Fahrenheit 451" represented in Extended Pigpen
"Fahrenheit 451" represented in Extended Pigpen

Licensing: I've had multiple people reach out and ask if they can use the Extended Pigpent Cipher in their projects / publications (someone even included it in a textbook). That's totally fine, I just ask that you attribute this to me (Thomas Hunter II). It's also nice if you send me a copy of what you've made with it but that's up to you. This license is CC BY-SA 4.0.

Tags: #security
Thomas Hunter II Avatar

Thomas has contributed to dozens of enterprise Node.js services and has worked for a company dedicated to securing Node.js. He has spoken at several conferences on Node.js and JavaScript and is an O'Reilly published author.