The Gold-Bug Deze pagina in het Nederlands


About the Gold-Bug

Original illustration for The Gold-Bug by Felix O. C. DarleyIn 1840, Edgar Allan Poe wrote an article in the Alexander's Weekly Messenger, a Philadelphia newspaper, where he challenged the readers to submit their own substitution ciphers which he would decrypt. Initially, he received cryptograms from around Philadelphia, but soon after, they came in from all over the United States. He published many of the cryptograms and their solutions in fifteen numbers of the Alexander's Weekly Messenger.

The next year, Poe published his essay called "A Few Words on Secret Writing" in Graham's Magazine, in which he commented on the response to his cipher challenge (see download below). The essay also gave birth to the famous quote that "human ingenuity cannot concoct a cipher which human ingenuity cannot resolve".

In the 19th century, most people considered secret writing and cryptography as a mysterious esoteric art, and Poe had sparked a great interest in cryptography with the general public. Thanks to Poe's publications, cryptogram puzzles became popular in newspapers and magazines. Inspired by the success of the cryptograms and the interest in his essay, he decided to write a short story that involved cryptography.

After writing The Gold-Bug, he submitted the story to a writing contest, winning the grand prize and $100. The story was published on June 21, 1843, in Philadelphia's Dollar Newspaper. It is regarded as the first important publication in popular non-technical literature that incorporated cryptography in its story line. The Gold-Bug contains a detailed description of how to solve a cryptogram using letter frequency analysis. The story was an instant success and helped popularize cryptography in the 19th century.

Edgar Allan Poe's The Gold-Bug is as iconic to cryptography in literature as David Kahn’s Codebreakers is to historical publications on the subject. It became one of his most read and best known stories. Many readers have set their first steps in cryptology after reading Poe’s story - some even became important codebreakers - and more than a few writers were inspired by Poe, to write their own story with secret writing and encrypted messages in it.

The Story

The main character in the story is William Legrand, a man who lives at Sullivan's Island, near Charleston, South Carolina, to escape from his misfortunes. Legrand discovers a brilliant gold-colored bug, but lends it out to someone else. When his friend, the narrator of the story, visits Legrand, he is told about the rare bug with a death's-head on its back, and Legrand draws him a picture of the bug on a piece of paper. A short while later, Legrand asks his friend to come visit him immediately. Upon the friend's arrival, the strangely behaving Legrand asks his friend to follow him on an expedition into the woods near some rocks, to search for a treasure. Afraid that Legrand has lost his mind, the friend decides to accompany him out of concern for Legrand's health. As it turns out, Legrand accidentally had discovered a secret message in invisible writing on the paper he used to draw the bug. Legrand later explains his friend how he found the message and how he was able to decrypt the message that started his quest for a hidden treasure.

The cryptogram, as discovered by Legrand:

Image by Dirk Rijmenants - Cipher Machines & Cryptology

A printable version is available here.

The Gold-Bug is not only an exciting story about the discovery of an old treasure, but also a great introduction to cryptography and codebreaking. It tickles the reader's curiosity and Poe gives a detailed description of how to decipher the cryptogram. While doing so, he also provides the solution. However, deciphering the message yourself is even more exciting than reading how Legrand did it in the story. Can I challenge you, just as Poe did, to decrypt Legrand’s message, composed more than 160 years ago?

Decrypting the Message

Rather than just reading Poe’s story, I will show you the technique and give you the chance to do it all by yourself. It might be usefull to read The Gold-Bug first, as the story might provide information that will help to solve the cryptogram, but read only to where the cryptgram appears. Don't cheat by reading or peeking any further! Don't search the Internet for Poe or The Gold-Bug, as this will also spoil the fun.

The message is encrypted by mono-alphabetic substitution, a cipher where the letters of the alphabet are replaced by other letters or symbols. We can calculate all possible combinations for 26 letter of the alphabet, replaced by 26 symbols: the first letter is substituted by one of 26 symbols, the second by one of the 25 remaining symbols, and so on (26 x 25 x 24…x 3 x 2 x 1). In total, this gives 403,291,461,126,605,635,584,000,000 different ways to allocate 26 symbols to 26 letters. How on earth could we possibly decipher such a cryptogram? For centuries, substitution ciphers were regarded as unbreakable...but it is easier than it looks.

Although there are trillions of ways to allocate a set of symbols to letters, there are only a few ways to combine vowels and consonants in a natural language. Strict rules determine which letter combinations are possible and which are forbidden. The syntax prescribes in what order words should be written and which conjugations should be used. When we substitute letters with symbols, those symbols still follow all these rules and thus create patterns that we can detect. Just as certain letter combinations are impossible (ZLG, XOJ,...), so will certain symbols avoid one another. Just as it is evident that the same vowels will always fit within a given set of consonants (THR?ST, G??D...) so will attract certain symbols each other. But where do we start?

The mystery weapon to solve our message is letter frequency analysis, the basis of all codebreaking. Each language has its own typical distribution of letters in a text. In English, the letter e is by far the dominant letter, with an average of 12.7 percent. If we locate some of the most frequent vowels or consonants in the ciphertext, or find recurring symbol combinations, then the rules of the language will give us strong leads to the words they are used in or the letters they represent. Below, you'll find the letters of the alphabet, ordered from most frequent at the left to least frequent at the right (Poe used an older and slightly different frequency table).


For Legrand’s message, start by taking a sheet with squares and write down the secret message with a pen. Leave some blank rows between each row of the message, to write your solution underneath the symbols with a pencil (easily corrected with a gum). Count how many times each of the symbols appears in the cryptogram and write down the results in a table, ordered from most to least frequent. You will see that one of the symbols clearly stands out. This is the first major clue. That most frequent symbol represents without doubt the most frequent letter of the alphabet. Write your first results underneath the according symbols on your message sheet.

Next, you try to spot recurring combinations of symbols. The most commonly used words in English are, in order of frequency: THE, OF, AND, TO and IN. Thus, you have to search for identical combinations of symbols that contain the most frequent letter you already found. You should spot each THE quite easily. If so, you have discovered the solution for two more letters that are used frequently. Make yourself a second table with all the symbols and their corresponding letters you already found.

By now, you should be able to find more and more letters by completing fragments. If, for instance, you find a fragment T?EE, it is not hard to imagine what should follow the letter T. Vowels twins (AA, EE, OO…) are common but not that many different words contain such pairs. Try to find those words. If you can’t see it immediately, try all letters of the alphabet until you get something readable. Each new letter will help you to reconstruct more and more fragments. Be patient. It could take some time before a word appears in front of you, but once you have four or five letters, you’re in a straight line to the finish.

Good luck...and make sure you don't get bitten by the bug!


External Links

Note: in the original edition, one symbol "(" was not printed near the end of the message, right after ‡9;48; although Legrand describes just that missing symbol to assist in finding a word. Since the story refers to that symbol, it is unlikely that it was omitted on purpose and probably got lost during the publishing.

Copyright 2004 - 2014 Dirk Rijmenants