Advanced | Help | Encyclopedia
Directory


Rail Fence Cipher

The Rail Fence Cipher is a form of transposition cipher that gets its name from the way in which it is encoded. In the rail fence cipher, the plaintext is written downwards on successive "rails" of an imaginary fence, starting a new column when we get to the top. The message is then read off in rows. For example, if we have 3 "rails" and a message of 'WE ARE DISCOVERED. FLEE AT ONCE', the cipherer writes out:

W R I O R F E O E P
E E S V E L A N J D
A D C E D E T C X Q

The extra odd letters at the end are "nulls", added to round off the pattern, or to confuse a cryptanalyst. Then reads off:

WRIOR FEOEP EESVE LANJD ADCED ETCXQ

(Grouping letters into blocks of a standard size, typically five, was a practice developed for ease of transmission by telegraph.)

Deciphering a Rail Fence Cipher

The easiest way to decipher a rail fence cipher is to use the following method:

1) First, run all the letters into a long string.

   [ WRIORFEOEPEESVELANJDADCEDETCXQ ]

2) Next, divide the string of letters into a number of even groups equal to the number of rails.

   [ WRIORFEOEP|EESVELANJD|ADCEDETCXQ ]
   

Since there are 30 letters, and we know there are 3 rails, we divide the group into 3 groups of 10.

3) Finally, write down the first letter from group 1, from group 2, and group 3, followed by the second letter from group 1, group 2, and group 3, etc.

   [ WEAREDISCOVEREDFLEEATONCEJXPDQ ]

4) Now just break the string of letters into easily identifiable words, separate the nulls, and the code is deciphered.

Problems with the Rail Fence Cipher

The rail fence cipher is not very strong; the number of practical keys is small enough that a cryptanalyst can try them all by hand. See also scytale.








Links: Addme | Keyword Research | Paid Inclusion | Femail | Software | Completive Intelligence

Add URL | About Slider | FREE Slider Toolbar - Simply Amazing
Copyright © 2000-2008 Slider.com. All rights reserved.
Content is distributed under the GNU Free Documentation License.