Substitution Ciphers - Appalachian State University

✐
✐
“crypttext” — 2017/3/17 — 11:28 — page 7 — #15
✐
✐
Chapter 2
Substitution Ciphers
One common and popular type of cipher for newspaper games and puzzle
books is a substitution cipher. In simple substitution ciphers, users agree
upon a rearrangement, or permutation, of the alphabet letters, yielding
a collection of correspondences to be used for converting plaintext letters
into ciphertext letters. This rearrangement of the alphabet letters is often
called the cipher alphabet. To say that the cipher alphabet is a permutation
means that each possible plaintext letter in the original alphabet is paired
with one and only one possible ciphertext letter, and vice versa. With
more sophisticated substitution ciphers, messages and cipher alphabets can
include numbers, punctuation marks, or mixtures of multiple characters,
and substitutions can be made for entire words or phrases.
As we will see in this chapter, simple substitution ciphers are not very
secure (meaning they are easy to break). Despite this, substitution ciphers
have a rich history of being used. One of the earliest known ciphers, the
Hebrew Atbash, was a substitution cipher, as was a cipher developed and
used by Julius Caesar that we will consider in Chapter 5, and a cipher
incorporated in Edgar Allan Poe’s The Gold Bug. Not all substitution
ciphers are easy to break, though. The cipher famously created during
World War II by the Navajo code talkers, which we will consider in this
chapter, and which was not known to have ever been broken during a period
of use that extended through the Korean War and into the early stages of
the Vietnam War, was essentially a substitution cipher.
2.1
Keyword Substitution Ciphers
One way to form a substitution cipher is to just use a random cipher alphabet.
7
✐
✐
✐
✐
✐
✐
“crypttext” — 2017/3/17 — 11:28 — page 8 — #16
✐
8
✐
CHAPTER 2. SUBSTITUTION CIPHERS
Example 2.1 Consider a substitution cipher with the following cipher alphabet.
Plain: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Cipher: T V X Z U W Y A D G K N Q B E H R O S C F J M P I L
Using this cipher alphabet, the plaintext YOUTH IS WASTED ON THE YOUNG1
encrypts to the ciphertext IEFCA DS MTSCUZ EB CAU IEFBY. This ciphertext
can be decrypted by using the same cipher alphabet but with the correspondences viewed in the reverse order.
!
A problem with using a random cipher alphabet is that it may be inconvenient or cumbersome for users to keep a record of. For instance, users
wishing to use a substitution cipher with the cipher alphabet in Example
2.1 would most likely have to keep a written record of this alphabet. One
solution to this problem would be for users to use a keyword in forming
the cipher alphabet. In this section, we will demonstrate two methods for
doing this.
2.1.1
Simple Keyword Substitution Ciphers
For simple keyword substitution ciphers, users agree upon one or more
keywords for the cipher. Spaces and duplicate letters in the keyword(s) are
removed, and the resulting letters are then listed in order as the ciphertext
letters that correspond to the first plaintext letters in alphabetical order.
The remaining alphabet letters not included in the keyword(s) are then
listed in alphabetical order to correspond to the remaining plaintext letters
in alphabetical order.
Example 2.2 Consider a simple keyword substitution cipher with the
keywords WILL ROGERS. Removing the space as well as the duplicate letters in these keywords gives WILROGES, and results in the following cipher
alphabet.
Plain: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Cipher: W I L R O G E S A B C D F H J K M N P Q T U V X Y Z
Using this cipher alphabet, the plaintext EVERYTHING IS FUNNY AS LONG AS
IT IS HAPPENING TO SOMEBODY ELSE2 encrypts to OUONYQSAHE AP GTHHY WP
DJHE WP AQ AP SWKKOHAHE QJ PJFOIJRY ODPO. To decrypt a ciphertext that
was formed using this cipher alphabet, we can use the same cipher alphabet but with the characters considered in the reverse order. For example,
the ciphertext QSO VADD NJEONP AHPQAQTQO OHEWEOP AH LWNRAJKTDFJHWNY
1 George
2 Will
Bernard Shaw (1856–1950), quote.
Rogers (1879–1935), quote.
✐
✐
✐
✐
✐
✐
“crypttext” — 2017/3/17 — 11:28 — page 9 — #17
✐
✐
9
2.1. KEYWORD SUBSTITUTION CIPHERS
FORALWD NOPOWNLS decrypts to THE WILL ROGERS INSTITUTE ENGAGES IN
CARDIOPULMONARY MEDICAL RESEARCH.
!
Example 2.2 reveals a problem with simple keyword substitution ciphers.
Often with this type of cipher, notably when the keyword doesn’t contain
any letters near the end of the alphabet, the last several correspondences
in the cipher alphabet are letters corresponding to themselves. Such correspondences are called collisions, and can make a cipher more vulnerable to
cryptanalysis. Keyword columnar substitution ciphers can help to alleviate
this problem.
2.1.2
Keyword Columnar Substitution Ciphers
For keyword columnar substitution ciphers, users again agree upon one or
more keywords, and remove spaces and duplicate letters in the keyword(s).
The resulting letters are then listed in order in a row, with the alphabet
letters not included in the keyword(s) listed in order in successive rows of
the same size beneath the keyword letters. The cipher alphabet is then
obtained by taking the columns of the resulting array of letters in order
starting from the left, and placing these columns as rows under the plaintext
letters.
Example 2.3 Consider a keyword columnar substitution cipher with
keywords ABE LINCOLN. Removing the space and duplicate letters gives
ABELINCO, and placing these letters in a row, with the remaining alphabet
letters listed in order in successive rows, yields the following array.
A
D
Q
Y
B
F
R
Z
E
G
S
L
H
T
I
J
U
N
K
V
C
M
W
O
P
X
Transcribing this array by columns starting from the left yields the following
cipher alphabet.
Plain: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Cipher: A D Q Y B F R Z E G S L H T I J U N K V C M W O P X
Using this cipher alphabet, the plaintext IF I WERE TWO-FACED WOULD I BE
WEARING THIS ONE3 encrypts to EF E WBNB VWI-FAQBY WICLY E DB WBANETR
VZEK ITB, and the ciphertext FICN KQINB ATY KBMBT PBANK ARI decrypts
to FOUR SCORE AND SEVEN YEARS AGO.4
!
3 Abraham
4 Abraham
Lincoln (1809–1865), quote.
Lincoln, from The Gettysburg Address.
✐
✐
✐
✐
✐
✐
“crypttext” — 2017/3/17 — 11:28 — page 10 — #18
✐
10
✐
CHAPTER 2. SUBSTITUTION CIPHERS
2.1 Exercises
1. Consider a substitution cipher with the following cipher alphabet.
Plain: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Cipher: X Q K M D B P S E T C L O R U J V A F W Z G H N I Y
(a) Use this cipher to encrypt QUOTH THE RAVEN NEVERMORE.5
(b) Use this cipher to encrypt A FEW WORDS ON SECRET WRITING.
(c) Decrypt WSD BXLL UB WSD SUZFD UB ZFSDA, which was formed
using this cipher.
2. Create a substitution cipher with a random cipher alphabet and use
it to encrypt a plaintext of your choice with at least 20 letters.
3. Decrypt X PUUM OXR EF SXAM WU BERM QZW BERMERP X PUUM MUP EF
DXFI, which was formed using a substitution cipher with the following
cipher alphabet.
Plain: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Cipher: X Q K M D B P S E T C L O R U J V A F W Z G H N I Y
4. Consider a simple keyword substitution cipher with the keyword
GILLIGAN.
(a) Use this cipher to encrypt A THREE HOUR TOUR.
(b) Use this cipher to encrypt A TALE OF A FATEFUL TRIP.
(c) Decrypt RGQUNJ WNJLD GUAETEOMNA BOR KGRY GMM, which was
formed using this cipher.
5. Create a simple keyword substitution cipher and use it to encrypt a
plaintext of your choice with at least 20 letters.
6. Decrypt TGLDUCHQ HOTL LSUOLS AGC QRHKSHG E CUPGHO AQ ADUFGT,
which was formed using a simple keyword substitution cipher with
the keywords APPALACHIAN STATE.
7. Consider a keyword columnar substitution cipher with the keywords
MARSHAL DILLON.
(a) Use this cipher to encrypt SATURDAY NIGHT IN DODGE CITY.
(b) Use this cipher to encrypt CAPTAIN KIRK WAS IN ONE EPISODE.
(c) Decrypt MGA HWDKCZ DLYUF MLLCMZCA VYIZ KWHCD, which was
formed using this cipher.
5 Edgar
Allan Poe (1809–1849), from The Raven.
✐
✐
✐
✐
✐
✐
“crypttext” — 2017/3/17 — 11:28 — page 11 — #19
✐
2.2. CRYPTANALYSIS OF SUBSTITUTION CIPHERS
✐
11
8. Create a keyword columnar substitution cipher and use it to encrypt
a plaintext of your choice with at least 20 letters.
9. Decrypt NZVAHX XHQZVCD PNQF SNZXWXNHNGXI NHC IQELLY AQQKDDKY,
which was formed using a keyword columnar substitution cipher with
the keywords NC STATE UNIVERSITY.
10. Create and describe a method different from those illustrated in this
section for using a keyword to form the cipher alphabet for a substitution cipher. Give at least one example of your method.
11. Find some information about the Hebrew Atbash cipher, including
how it worked, and write a summary of your findings.
12. Find some information about Edgar Allan Poe’s interest in cryptography, including the various cryptographic challenges he offered, and
write a summary of your findings.
13. Find a copy of Edgar Allan Poe’s short story The Gold Bug, and write
a summary of how a substitution cipher is integrated into the story.
14. Find a copy of Sir Arthur Conan Doyle’s Sherlock Holmes mystery
The Adventure of Dancing Men, and write a summary of how a substitution cipher is integrated into the story and how the cipher worked.
2.2
Cryptanalysis of Substitution Ciphers
Considering the number of possible cipher alphabets, substitution ciphers
seem impossible to break. With 26 letters, there are more than 4 × 1026
possible cipher alphabets. To test them all would be infeasible. However,
as it turns out, most simple substitution ciphers are fairly easy to break
through the use of frequency analysis. In fact, inadequate security of substitution ciphers has even altered the course of history. For example, the
breaking of a substitution cipher led to the execution of Mary, Queen of
Scots in 1587.
In languages like English, it is known that certain letters and combinations of letters occur more often than others. In ordinary English, the
letters that naturally occur the most often are, in order, E, T, A, O, I, N, and
S. The frequency with which each of the 26 letters in our alphabet occurs
in ordinary English is shown in Table 2.1 on page 12.
Common digraphs (letter pairs), trigraphs (letter triples), and repeated
letters in ordinary English are also known. The most common digraphs are
TH, ER, ON, AN, RE, HE, IN, ED, and ND. The most common trigraphs are
THE, AND, THA, ENT, ION, TIO, FOR, NDE, HAS, and NCE. The most common
✐
✐
✐
✐