Holmes’s skills: cryptography

One of the Holmes’s skills is cryptography. Cryptography is the science that studies how to decipher encoded messages as well as how to codify them. This is an activity as old as intelligence services. Most of the ciphers are build by mathematicians or  people very skilled at mathematics.

Holmes is also a competent cryptanalyst. He relates to Watson, “I am fairly familiar with all forms of secret writing, and am myself the author of a trifling monograph upon the subject, in which I analyse one hundred and sixty separate ciphers” One such scheme is solved using frequency analysis in “The Adventure of the Dancing Men” which uses a series of stick figures, for example:



What is a substitution cipher method? 

In cryptography, a substitution cipheris a method of encryption by which units of plaintext are substituted with ciphertext according to a regular system; the “units” may be single letters (the most common), pairs of letters, triplets of letters, mixtures of the above, and so forth. The receiver deciphers the text by performing an inverse substitution.

There are a number of different types of substitution cipher. If the cipher operates on single letters, it is termed a simple substitution cipher; a cipher that operates on larger groups of letters is termed polygraphic. A monoalphabetic cipher uses fixed substitution over the entire message, whereas a polyalphabetic cipher uses a number of substitutions at different times in the message—such as with homophones, where a unit from the plaintext is mapped to one of several possibilities in the ciphertext.


 One example: Caesar cipher

In cryptography, a Caesar cipher, also known as a Caesar’s cipher, the shift cipher, Caesar’s code or Caesar shift, is one of the simplest and most widely known encryption techniques.It is a type of substitution cipher in which each letter in the plaintext is replaced by a letter some fixed number of positions down the alphabet. This is a simple substitution. For example, with a shift of 3, A would be replaced by D, B would become E, and so on. The method is named after Julius Caesar, who used it to communicate with his generals.

The encryption step performed by a Caesar cipher is often incorporated as part of more complex schemes, such as the Vigenère cipher, and still has modern application in the ROT13 system. As with all single alphabet substitution ciphers, the Caesar cipher is easily broken and in practice offers essentially no communication security.


ROT13 is a Caesar cipher a type of substitution cipher. In ROT13, the alphabet is rotated 13 steps.


 What is the frequency analysis? 

In cryptanalysis, frequency analysisis the study of the frequency of letters or groups of letters in a ciphertext. The method is used as an aid to breaking classical ciphers, as the one deciphered in “The Dancing Men” by Holmes.

Frequency analysis is based on the fact that, in any given stretch of written language, certain letters and combinations of letters occur with varying frequencies. Moreover, there is a characteristic distribution of letters that is roughly the same for almost all samples of that language. For instance, given a section of English language, E tends to be very common, while X is very rare. Likewise, ST, NG, TH, and QU are common pairs of letters (termed bigrams or digraphs), while NZ and QJare rare. The phrase “ETAOIN SHRDLU” encodes the 12 most frequent letters in typical English language text.



 The histogram above is a typical distribution of letters in English language text. Weak ciphers do not sufficiently mask the distribution, and this might be exploited by a cryptanalyst to read the message.


The Adventure of The Dancing Men, a good reading suggestion

The Adventure of the Dancing Men is one of the 56 Sherlock Holmes short stories written by British author Sir Arthur Conan Doyle. It  is one of 13 stories in the cycle collected as The Return of Sherlock Holmes.

The story began when Hilton Cubitt asks for Holmes’s help. His wife, Elsie, who is American, received a letter from the United States, which evidently disturbed her, and she threw the letter on the fire. Then the dancing men appeared scrawled in chalk on a windowsill of and afterwards on a piece of paper left on the sundial overnight. Each time, their appearance has an obvious, terrifying effect on Elsie, but she will not tell her husband what is going on.

Holmes tells Cubitt that he wants to see every occurrence of the dancing men. They are to be copied down and brought or sent to him at 221B Baker Street. Cubitt does this, and it provides Holmes with the most important clue in the mystery.

Holmes examining the drawing

Holmes quickly realizes that it is a substitution cipher. Through much brainwork, he cracks the code by frequency analysis.The last of the messages conveyed by the dancing men is a particularly chilling one, and Holmes …. I won’t say anything more.

Read this thrilling history!!

I forgot it. He explains how he deciphers the message !!! 



  1. Read through your article. Quite interesting. I will like to ask two questions:
    1.what is the most common ways of combating frequency analysis in cryptography.
    2.How will this help WEP (Wired Equivalent Privacy) in combating against it.

  2. this site s really useful as i love holmes stories much… this created an eagerness to read tat dancing men book….

Comments RSS TrackBack Identifier URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s