Pigpen Cipher


The Pigpen cipher is a simple substitution cipher that was used by the Freemasons in the 18th century. It involves substituting letters for symbols. The key to understanding the symbols is shown below,

Pigpen cipher key

The lines and dots in the vicinity of each letter make up the symbol that is used to encrypt it. The following is the Pigen encryption of the word SECRET.

Pigpen Message

Programming The Cipher

This one is a little trickier than the other ciphers. We can't just do some intelligent Maths with the character codes or swap one letter for another.

Your first step would be to create all of the individual letter symbols as separate graphics. You could draw these out by hand or write code that does the same. Next, create an array to store these images. When reading each letter from the plain text message, subtract 65 from the character's ASCII code and you have the subscript of the image that you need to substitute for the letter. Javascript allows you to 'pre-load', store and use images in scripts. You could also do this with PHP or with Visual Studio. A little bit of thought and Scratch is also suitable.

Here is a screenshot from a program that generates Pigpen cipher text as an exportable image,

Pigpen Encryption Program