0% found this document useful (0 votes)
320 views6 pages

Rail Fence Cipher Explained

The rail fence cipher jumbles the letters of a message in a quick and convenient way by writing the letters diagonally down rows of an imaginary fence. It uses a key to determine the number of rows, with the letters written zigzag down and up the rows. The encrypted message is then read off row by row.

Uploaded by

Ivan Pascual
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
320 views6 pages

Rail Fence Cipher Explained

The rail fence cipher jumbles the letters of a message in a quick and convenient way by writing the letters diagonally down rows of an imaginary fence. It uses a key to determine the number of rows, with the letters written zigzag down and up the rows. The encrypted message is then read off row by row.

Uploaded by

Ivan Pascual
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

RAIL FENCE

CIA 1101- IT 2D
RAIL FENCE

The rail fence cipher (also called a zigzag cipher)


is an easy to apply transposition cipher that
jumbles up the order of the letters of a message in
a quick convenient way. It also has the security of
a key to make it a little bit harder to break.

Add a Footer 2
Encryption

To encrypt a message using the Rail Fence Cipher, you have to write your message in zigzag lines across the page, and
then read off each row. Firstly, you need to have a key, which for this cipher is the number of rows you are going to
have. You then start writing the letters of the plaintext diagonally down to the right until you reach the number of rows
specified by the key. You then bounce back up diagonally until you hit the first row again. This continues until the end
of the plaintext.

For the plaintext we used above, "defend the east wall", with a key of 3, we get the encryption process shown below.

The ciphertext is read off row by row to get "DNETLEEDHESWLXFTAAX".

Add a Footer 33
EXAMPLE
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

44
EXAMPLE
Suppose we want to encrypt the message “buy your books in August” using a rail fence cipher with encryption key 3.

• Arrange the plaintext characters in an array with 3 rows (the key determines the number of rows), forming a zig-zag
pattern:

• Then concatenate the non-empty characters from the rows to obtain the ciphertext:

BOOIGUYUBOSNUUTYRKAS

55
REFERENCE

• HTTPS://EN.WIKIPEDIA.ORG/WIKI/RAIL_FENCE_CIPH
ER

66

You might also like