Transposition Cipher
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.
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
*___*___*___*
_*_*_*_*_*_*
__*___* ___*_
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.