- Shopping Bag ( 0 items )
"A fascinating, challenging book." ? A.L.A. Booklist
Learn to use the most important codes and methods of secret communication in use since ancient times. Cipher and decipher codes used by spies. Explore the famous codes that changed the fate of nations and political leaders. And enjoy hours of fun experimenting with cryptography ? the science of secret writing.
Beginning with simple letter substitutions and transposition ciphers, ...
"A fascinating, challenging book." ― A.L.A. Booklist
Learn to use the most important codes and methods of secret communication in use since ancient times. Cipher and decipher codes used by spies. Explore the famous codes that changed the fate of nations and political leaders. And enjoy hours of fun experimenting with cryptography ― the science of secret writing.
Beginning with simple letter substitutions and transposition ciphers, world-famous science writer Martin Gardner explains how to break complicated polyalphabetical ciphers and codes worked with grids, squares, triangles, and charts. You'll learn codes that are keyed to typewriters and telephone dials . . . even codes that use playing cards, knots, and swizzle sticks. Experiment with invisible writing ― inks that glow in black light and turn red under heat ― and explore the possibilities of sending messages through outer space to unknown worlds.
Using this book, you can solve the historically famous Playfair Cipher used by Australia in World War II, the Pigpen Cipher used by Confederate soldiers during the Civil War, Thomas Jefferson's Wheel Cipher, the Beaufort system used by the British Royal Navy, codes devised by authors for heroes in literature ― Sherlock Holmes, Captain Kidd, and the Shadow. And you will enjoy experimenting with bizarre methods of message sending ― the Dot Code, Knot Code, Swizzle Code, and more.
Young cryptanalysts, cipher fans, and puzzlists of all ages will find hours of intrigue and challenge in Codes, Ciphers and Secret Writing.
"A stimulating must for the intermediate cryptographer." ― The Kirkus Reviews
Easy Transposition Ciphers
A transposition cipher is one that does not change any letters of the original message. (Cryptographers call the original the "plaintext" but we will simply call it the "message.") It merely rearranges the letters, according to a secret system, so that anyone who knows the system can put the letters back in their proper order and read the message.
The simplest transposition cipher is made by just writing the message backward. AGENT 427 IS ON HIS WAY becomes YAW SIH NO SI 724 TNEGA. If the message happens to be a palindrome—a sentence that reads the same in both directions—the letters will be in exactly the same order when reversed. For example: PULL UP IF I PULL UP, or 'TIS IVAN ON A VISIT. This is not likely to happen, however, with any genuine message.
The main trouble with backward writing is that it is too easy to recognize. If you keep the original word order, but reverse the letters of each word separately, the reversal is a bit harder to spot, but not much. The following transposition ciphers are better and almost as easy to remember and use.
 The Rail Fence Cipher
Suppose you wish to encipher this message:
MEET ME TONIGHT
Count the number of letters. If the number is a multiple of 4, well and good. If not, add enough dummy letters at the end to make the number a multiple of 4. In this case there are 13 letters so we add three dummy letters, QXZ, to total 16. Such dummy letters are called "nulls." In a moment we will see why the nulls are added.
Write the message by printing every other letter a trifle lower on the page. The message will look something like a rail fence:
M E M T N G T X
E T E O I H Q Z
Copy the top row, then continue by copying the lower row.
M E M T N G T X E T E O I H Q Z
Encoding and decoding is simpler and more accurate if you divide the cipher text into groups of four or five letters each, because it is easy to keep that many letters in your head when you write. Besides, this makes the cipher harder to "crack" by the "enemy" because the divisions between the words are not indicated. In this book we will use a 4- group system. That was why three nulls were added in the preceding message. By increasing the number of letters to 16, we make sure that the last group of letters in the cipher text will have four letters like all the other groups.
This is how the final cipher text will appear:
MEMT NGTX ETEO IHQZ
Decoding the message is just as easy as encoding. First divide the cipher text exactly in half by a vertical line:
MEMT NGTX | ETEO IHQZ
Now read the original message by checking off the first letter of the left half, the first letter of the right half, the second letter of the left half, the second letter of the right half, and so on. Ignore the three nulls at the ends. It is easy to guess where the spacings belong between words.
You can vary the rail fence cipher, if you like, by copying the two rows in reverse order, or by copying one row forward and the other backward. The decoding procedure, which you can easily work out for yourself, has to be changed accordingly.
Other variations can be obtained by writing the letters in a zigzag of more than two lines. For example, a 3-line rail fence cipher would begin like this:
M M N T
E T E O I H Q Z
E T G X
MMNT ETEO IHQZ ETGZ
The best way to understand a cipher is to use it for decoding an actual message. Throughout the book you will find "Practice Riddles" with coded answers that can be read only by deciphering them. Please do not try to do this directly on the book's pages. Copy the coded answer on a sheet of paper, then do all your work on that sheet. In this way you won't deface the book and spoil the fun for the next reader (if it is a library book), or for a friend who may wish to borrow your book.
PRACTICE RIDDLE 1
What goes "Tee, he, he, he, he, plop!"?
AALU HNHS EDFY MNAG IGIH AOFZ
(This is a two-row, rail fence cipher. Read from left to right.)
 The Twisted Path Cipher
This is an elaboration of the letter-scrambling technique of the rail fence cipher. It uses a rectangular grid, or "matrix" as we will call it, which is simply a checkerboard of empty squares, or cells. Let's take a slightly longer sample message than the previous one:
MEET ME THURDSDAY NIGHT
The message has 19 letters. As before, we add enough nulls (in this case only one is needed) to make a multiple of 4. For the 20 letters it will be convenient to use a 4–by–5 matrix. The message, with a null X at the end, is written in the 20 cells, from left to right, taking the rows from top to bottom:
The next step is to trace on the matrix a particular path, the shape of which is agreed upon in advance by everyone who will be using the code. It is not a good idea to start the path by moving horizontally along the top row, left to right, because your cipher text would start with MEET, which would be recognized as a word and provide a clue to your system. A good path, called a "plow path" because farmers use this pattern to plow their fields, is shown on the next page.
Copy the letters along the path, starting with the bottom cell on the right and following the curved line as it twists its way upward and leftward. The cipher text, written in groups of four, will be:
XNRM TUYT HAHE ETDG ISEM
To decipher, draw an empty 4–by–5 matrix, then fill in the cells with the letters of the cipher text. The first letter, X, goes in the lower right corner. N goes in the cell above it. Continue writing the letters along the same plow path that was used in coding the message. The message is read by taking each row from left to right, starting with the top row.
Another good path is a spiral. You can start the spiral at any corner cell and whirl inward, clockwise or counterclockwise, or you can begin at one of the central cells and spiral outward as shown below:
This spiral produces the cipher:
HUYA DTEE TMRN XTHG ISEM
If you want to make this code even harder to break, you can combine two different paths. For example: Write the message in the matrix along a plow path instead of left to right by rows. Then encode it by taking the letters along a spiral path. To decode, write the letters of the cipher text along the spiral path, then read them along the plow path.
Of course you and whoever receives the code must agree beforehand on the exact method to be used, as well as on the dimensions of the matrix. If you wish to vary the size and shape of the matrix with each message, you can put one number at the beginning of the cipher to indicate the height of the matrix, and another number at the end to indicate its width. This might, however, tip off the enemy that you are using a matrix to scramble the letters. You could use a secret ink (see Chapter 6) to put 4–5 in a corner of the sheet, or to put dots over the fourth and fifth letters of the message, or some other system of your own invention.
Paths do not have to be continuous. You can take the columns in order, from right to left, starting each column at the bottom, for example, and moving upward. Diagonals can also be used for paths, either broken or continuous. You can go up each diagonal from left to right:
Or you can follow a diagonal plow path:
Indeed, you can adopt any type of path you like as long as everyone who sends and receives the cipher knows exactly what kind of path (or paths) is being used.
PRACTICE RIDDLE 2
What is gray, lives in a tree, and is terribly dangerous?
INEG UNHT RIUQ SARH AMAC IWLE
(A 4–by–6 matrix was filled by writing left to right, from top to bottom. Then the answer was encoded along a counterclockwise spiral beginning at the lower left corner.)
 Scrambling with a Key Word
This is a subtle and historically important variation of the previous transposition method. Instead of using regular paths, broken or continuous, a "key word" is employed for mixing up the columns of a matrix in a completely haphazard way.
We will explain how it works by using the same message as before and the same 4–by–5 matrix. First the message is written in the 20 cells according to an agreed-upon plan. Let's assume it is along a clockwise spiral:
We now wish to scramble the order of the columns. To do this, we could simply number the columns from 1 to 5, but mix up the digits. Our key number would be, say, 25143. Numbers, however, are not easy to remember, and that is where the key word comes in.
Any five-letter word, with no two letters alike, can serve as the key. Let's use the name FRANK. If we number these letters in the order in which they appear in the alphabet, A will be 1, F will be 2, K will be 3, N will be 4, and R will be 5.
2 5 1 4 3
F R A N K
In this simple way, FRANK produces the five-digit number 25143. Write the five digits above the columns of the matrix:
The digits tell us the order to follow in copying the columns from top down. Copy first the column headed 1, then the column headed 2, and so on to column 5. The cipher text will be:
EITR MYAD METH TGHU ENXS
The person who receives the cipher knows that the key word is FRANK, from which he quickly derives the number 25143. He draws the empty matrix, puts the digits above the columns, then copies the cipher vertically in each column, in the order indicated by the digits. After filling columns 1 and 2, his matrix will look like this:
When all the cells are filled, the message is read along the agreed-upon clockwise spiral path. The advantage of this method is that it does not use simple and regular paths which could be guessed by a clever enemy who might "intercept" (as cryptographers like to say) the cipher text. Instead, it furnishes a haphazard broken path which is hard to discover unless one knows both the system and the key word.
Key words are so easy to remember that you and your friends can change the cipher every week by just picking a new word. A rectangular matrix of any size or shape can be used, but of course the key word must have the same number of letters as there are matrix columns. Using key words, or key phrases, to "randomize" cipher texts is an ancient but valuable technique. It is still used today in many of the elaborate cipher systems employed by nations throughout the world.
PRACTICE RIDDLE 3
What is gray and has four legs, a tail, and a trunk?
MTZG UIPI AANO ORXN SEGO
(This uses the matrix and the procedure just described, except the key word is JANET.)CHAPTER 2
Easy Substitution Ciphers
In the ciphers discussed in the previous chapter, all the letters of a message remain the same when encoded. Only the order of the letters is changed. In a substitution cipher, the order of letters stays the same, but for each letter a different letter, or perhaps some kind of symbol, is used. Such ciphers are called substitution ciphers because something is substituted for every letter of the message. Substitution and transposition ciphers can be combined in all sorts of ways, but then the code becomes overly complicated and it is easy to make mistakes in encoding and decoding. (Professional cryptographers, by the way, restrict the word "code" to secret writing in which entire words or phrases are substituted for other words, listed in a special codebook. However, in this book we will follow the common practice of using "code" as another word for cipher.)
Most of the following substitution ciphers are known as "monoalphabetic," (or single alphabet). This means that, for every letter, one and only one letter (or symbol) is substituted. If the code letter for T is K, then whenever there is a K in the cipher text it means T, and no other letter in the text can mean T.
There is a big advantage in having a method of substitution that is easy to remember. If you and your friends have to carry around a complete alphabet key, someone might find it and steal it. He could then read all your coded messages. This has actually happened many times in history. A spy will manage to steal an alphabet key or make a copy of it. The secret cipher becomes, of course, totally worthless. But if the cipher system is kept only in your head, no one can steal it.
One of the simplest and oldest substitution ciphers is created by writing the alphabet forward, then underneath, the alphabet is written backward:
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
Z Y X W V U T S R Q P O N M L K J I H G F E D C B A
Each letter stands for the letter directly below (or above) it. A message such as MYRTLE HAS BIG FEET would be written:
NBIGOV SZH YRT UVVG
or, if you group the letters in quadruplets:
NBIG OVSZ HYRT UVVG
ote how the word "big" reappears near the beginning of the cipher text. It is just a coincidence, but amusing coincidences of this sort are very common in cipher writing. Sometimes they cause a lot of trouble for cryptanalysts because they are taken as clues. Of course they only lead the analysts off into false trails.
Another simple method is to number the letters of the alphabet forward (A = 1, B = 2, C = 3, and so on) or number them backward (A = 26, B = 25, C = 24, and so on). The numbers are used instead of letters. Dashes should go between the numbers to distinguish one-digit numbers from two-digit numbers.
Both these methods—the backward alphabet and the numbers in sequence—are too risky to use. They are so well known that your enemy is likely to know them, too. It takes only a minute or two to test a cipher to see if such a simple substitution method was employed. The systems that follow are much superior.
 Shift Ciphers
These are often called Caesar ciphers because the great Roman emperor Julius Caesar used them for secret government messages. They are easy to encode and decode.
A key number, known only to you and your friends (and which can be varied from time to time), tells you how far to shift a second alphabet when it is written underneath the first one. Suppose the key number is 7. Write the alphabet in a row. Put your pencil point on A and count seven letters to the right, starting on B and ending on H. Put A above H. Continue to the right with B, C, D, ... until you reach Z, then go back to the beginning and finish the alphabet. Your 7-shift cipher will look like this:
T U V W X Y Z A B C D E F G H I J K L M N O P Q R S
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
To encode a message, find the letter in the top row and substitute for it the letter immediately below. Each letter in MYRTLE shifts forward seven letters to become TFYASL. To decode, find the letter in the bottom row and write the letter above it.
Needless to add, in this and other ciphers that use simple alphabet keys, you must always completely destroy the key after you have encoded or decoded a message. If you don't, someone might find the key, in a wastebasket perhaps, and learn the secret of your code.
Occasionally a word, by sheer coincidence, becomes another word when it is shifted. A good example is the word COLD. Try encoding it in a 3–shift cipher and you'll be surprised by what you get. What happens to PECAN in a 4–shift cipher? To SLEEP in a 9–shift? Try them and find out! It's fun to look for words that become other words in a shift cipher. Of course, the longer a word the less likely that a letter shift will produce another word. One of the longest of such words in English is ABJURER. In a 13-shift cipher it becomes NOWHERE.
PRACTICE RIDDLE 4
What did Mr. MacGregor buy a roll of Scotch Tape for?
What did he want it for?
(This is a 13–shift cipher.)
 Date Shift Ciphers
To make a shift cipher harder to break, you can vary the amount of the shift from letter to letter. There are many ways to do this. One clever way is to use the date on which you send the message as your key.
For example, assume you wish to send a message on October 21, 1973. October is the tenth month of the year. The date can be written: 10–21–73. Eliminate the dashes and you have the number 102173. Write this number repeatedly over the message:
102173 102 173 1021
MYRTLE HAS BIG FEET
To encode the message, shift M forward one letter. It becomes N. (When the shift numbers are small, it is easy to learn how to make all the shifts in your head without having to write down two rows of the alphabet.) Y is to be shifted a zero distance, so it just stays Y. R moves ahead two letters to become T, and similarly with the other letters. Remember, if a shift carries you past Z, go back to A and continue the count.
The final cipher message, using 102173 as the key and spacing the letters in groups of four, will be:
NYTU SHIA UCPJ GEGU
To decode, write the key number over the cipher text, the same way you did for encoding, then shift each letter backward in the alphabet by a distance indicated by the digit above it. Whenever a back shift takes you beyond A, go to Z and continue the backward count.
Note that the cipher is not a monoalphabetic one. The last quadruplet, for example, stands for FEET. But the two E's in "feet" are represented by different letters, and the two G's in GEGU represent different letters. It is this which makes the date-shift cipher harder to crack. As we shall learn in Chapter 4, a cipher of this type is called polyalphabetic.
You don't have to use the date to provide the key number for a variable shift cipher. Any number will do, and you can remember the key number by using a key word as explained in Chapter 1, code 3.
PRACTICE RIDDLE 5
What did Paul Revere say when he finished his midnight ride?
(Use the date of Paul Revere's ride, April 18, without the year.)
 Key Word Ciphers
Here is a simple way to construct a substitution cipher alphabet by using a key word or phrase. Suppose you and your pals agree that the week's key word is JUPITER. Write the alphabet in a row. Underneath, write JUPITER, followed by all the other letters in alphabetical order:
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
J U P I T E R A B C D F G H K L M N O Q S V W X Y Z
Excerpted from CODES, CIPHERS AND SECRET WRITING by Martin Gardner. Copyright © 1972 Martin Gardner. Excerpted by permission of Dover Publications, Inc..
All rights reserved. No part of this excerpt may be reproduced or reprinted without permission in writing from the publisher.
Excerpts are provided by Dial-A-Book Inc. solely for the personal use of visitors to this web site.