Rail fenceTransposition cipher that uses a railfence pattern
For the rail fence cipher, the plaintext is written diagonally downwards 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" are chosen and the cleartext message is “CT-ONLINE”, then the cipher scheme looks like:
C . . . N . . . E
. T . O . L . N .
. . - . . . I . .
This reads off to the ciphertext: CNETOLN-I
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.