1. To trial the platform and take tests, please take a few seconds to SIGN UP
and SET UP FREE.
2. Searching for something specific? See our text overview of all tests. Includes 'real teacher' use videos.
The rail fence cipher (also called a zigzag cipher) is a form of transposition cipher. It derives its name from the way in which it is encoded.
In the rail fence cipher, the plain text is written downwards and diagonally on successive "rails" of an imaginary fence, then moving up when the bottom rail is reached. When the top rail is reached, the message is written downwards again until the whole plaintext is written out. The message is then read off in rows. For example, if 3 "rails" and the message 'WE ARE DISCOVERED. FLEE AT ONCE' is used, the cipherer writes out:
W . . . E . . . C . . . R . . . L . . . T . . . E . E . R . D . S . O . E . E . F . E . A . O . C . . . A . . . I . . . V . . . D . . . E . . . N . .
Then reads off to get the ciphertext:
WECRLTEERDSOEEFEAOCAIVDEN
Note that this particular example does NOT use spaces separating the words.
www.teachyourselfpython.com