The first installment of Edgar Allan Poe’s short story, “The Gold Bug” appeared in “The Dollar” newspaper in Philadelphia on June 21, 1843.

The story is about William Legrand, who was bitten by a gold-colored bug. His servant, Jupiter, thinks Legrand is going insane and asks Legrand’s friend, the story’s narrator, to come back with him to visit his old friend. Legrand then gets the narrator and Jupiter involved in a hunt after deciphering a secret message that leads to a buried treasure.

The story involves cryptography with a description of a method for solving a simple substitution cipher using letter frequencies.

Simple Substitution System

In a simple substitution system, each plaintext  letter has one ciphertext equivalent.  The ciphertext letter frequencies will not be identical to the plaintext frequencies, but the same numbers will be present in the frequency count as a whole.  For example, if there are 33 Es in the plaintext of a message, and if E is enciphered by the number 8, then 33 8s will appear in the ciphertext frequency count, as shown below.  Of note: For the English language, the letter E is the most frequently used letter followed by T, N, R, O, A, I and S.  The lowest frequency letters are J, K, Q, X and Z.  Knowing the frequency of each letter is the first step in attacking a substitution system; the next step is recovering the key used the encipher the plaintext.

freq
The key with letter frequency to the right
freq1
Cryptogram letter frequency
freq2
English letter frequency
06
The message solved

The decoded message with spaces, punctuation, and capitalization is:

A good glass in the bishop’s hostel in the devil’s seat
forty-one degrees and thirteen minutes northeast and by north
main branch seventh limb east side
shoot from the left eye of the death’s-head
a bee line from the tree through the shot fifty feet out.

Happy birthday Mr. Poe.

07
Edgar Allan Poe
January 19, 1809 – October 7, 1849