0% found this document useful (0 votes)
61 views3 pages

Transposition Cipher

The document discusses different types of transposition ciphers including rail fence cipher and columnar transposition cipher. Rail fence cipher encrypts the plaintext by writing it diagonally on successive rails of an imaginary fence and then combining the rows. Columnar transposition cipher writes the plaintext in rows of a fixed length defined by a keyword and then reads it off column by column in the order specified by the keyword.

Uploaded by

Sourav Debnath
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)
61 views3 pages

Transposition Cipher

The document discusses different types of transposition ciphers including rail fence cipher and columnar transposition cipher. Rail fence cipher encrypts the plaintext by writing it diagonally on successive rails of an imaginary fence and then combining the rows. Columnar transposition cipher writes the plaintext in rows of a fixed length defined by a keyword and then reads it off column by column in the order specified by the keyword.

Uploaded by

Sourav Debnath
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/ 3

Transposition Cipher

Transposition Cipher is a cryptographic algorithm where the order of alphabets in the plaintext is rearranged
to form a cipher text. In this process, the actual plain text alphabets are not included.

Rail Fence Cipher – Encryption and Decryption


In a transposition cipher, the order of the alphabets is re-arranged to obtain the cipher-text.
• In the rail fence cipher, the plain-text is written downwards and diagonally on successive rails of an
imaginary fence.
• When we reach the bottom rail, we traverse upwards moving diagonally, after reaching the top rail,
the direction is changed again. Thus, the alphabets of the message are written in a zig-zag manner.
• After each alphabet has been written, the individual rows are combined to obtain the cipher-text.
• For example, if the message is “GeeksforGeeks” and the number of rails = 3 then cipher is prepared
as:

Its encryption will be done row wise i.e. GSGSEKFREKEOE

Decryption

As we’ve seen earlier, the number of columns in rail fence cipher remains equal to the length of plain-text
message. And the key corresponds to the number of rails.

• Hence, rail matrix can be constructed accordingly. Once we’ve got the matrix we can figure-out the
spots where texts should be placed (using the same way of moving diagonally up and down
alternatively).
• Then, we fill the cipher-text row wise. After filling it, we traverse the matrix in zig-zag manner to
obtain the original text.
Implementation:
Let cipher-text = “GsGsekfrekeoe” , and Key = 3
Number of columns in matrix = len(ciphertext) = 13
Number of rows = key = 3
Hence original matrix will be of 3*13, now marking places with text as ‘*’ we get

*___*___*___*
_*_*_*_*_*_*
__*___* ___*_

Columnar Transposition Cipher


The Columnar Transposition Cipher is a form of transposition cipher just like Rail Fence Cipher. Columnar
Transposition involves writing the plaintext out in rows, and then reading the ciphertext off in columns one
by one.

Encryption
In a transposition cipher, the order of the alphabets is re-arranged to obtain the cipher-text.
• The message is written out in rows of a fixed length, and then read out again column by column, and
the columns are chosen in some scrambled order.
• Width of the rows and the permutation of the columns are usually defined by a keyword.
• For example, the word HACK is of length 4 (so the rows are of length 4), and the permutation is
defined by the alphabetical order of the letters in the keyword. In this case, the order would be “3 1 2
4”.
• Any spare spaces are filled with nulls or left blank or placed by a character (Example: _).
• Finally, the message is read off in columns, in the order specified by the keyword.
Decryption

• To decipher it, the recipient has to work out the column lengths by dividing the message length by
the key length.
• Then, write the message out in columns again, then re-order the columns by reforming the key word.

You might also like