Tool to decrypt/encrypt with a transposition. A transposition cipher, also called columns permutation, is a technique to change the order of the letters in a text by placing it in a grid.

Transposition Cipher - dCode

Tag(s) : Transposition Cipher

dCode is free and its tools are a valuable help in games, maths, geocaching, puzzles and problems to solve every day!

A suggestion ? a feedback ? a bug ? an idea ? *Write to dCode*!

Transposition cipher is the name given to any encryption that involves rearranging the plain text letters in a new order.

However, in the literature, the term transposition cipher is generally associated with a subset: columnar transposition (or rectangular transposition) which consists of writing the plain message in a table / grid / rectangle, then arranging the columns of this table according to a defined permutation.

The permutation key is a series of numbers (often generated from a word) which indicates in which order to arrange the columns.

__Example:__ The word `KEY` makes the permutation `2,1,3` :

Before alphabetical sort | After alphabetical sort | |

Word | K,E,Y | E,K,Y |

Column Order | 1,2,3 | 2,1,3 |

In particular, the columnar transposition cipher consists to write a message in a table of width N (with N, the size of the permutation), row by row (or column by column), to permute the columns according to the order of the key and read the result in columns (or by lines).

__Example:__ Encrypt `MESSAGE` by columnar transposition with the key `CODE` (permutation `1,3,4,2`) gives `MASESEG` (writing in rows and reading the table by columns)

Columns | 1,2,3,4 | Sorted cols | 1,3,4,2 |

Plain text | M,E,S,S | Cipher text | M,S,S,E |

A,G,E,_ | A,E,_,G |

Some variants consist in reading the table in rows and not in columns, in this case, the encrypted message with a reading in column would be `MASES_EG`.

If the grid contains empty boxes, it is possible to complete them with a neutral letter `X` (or other more frequent letter) in order to facilitate manual decryption.

Transposition cipher decryption is identical to encryption except that the order of the columns is changed/reversed.

If the message has a length (number of characters) which is not a multiple of the size of the permutation, then it is necessary to pre-calculate the position of the empty boxes in the grid (by simulating a filling similar to encryption).

__Example:__ A permutation `2,1,3` has been used to get the message `CDOEDX` (read by row):

Columns | 2,1,3 | Sorted columns | 1,2,3 |

Ciphertext | C,D,O | Plaintext | D,C,O |

E,D,X | D,E,X |

__Example:__ The plain text is `DCODEX`.

If the message was read in columns, first write the table by columns

__Example:__ A permutation `2,1,3` has been used to get the message `CEDDOX` (read by column):

Columns | 2,1,3 | Sorted columns | 1,2,3 |

Ciphertext | C,D,O | Plaintext | D,C,O |

E,D,X | D,E,X |

__Example:__ The plain text is `DCODEX`.

The message consists of the letters of the original message but in a different order.

The index of coincidence is identical to that of the one of the language of the plaintext.

It is possible to test all the permutations if the key is not too long, but the most effective method is to have or try to guess a word from the plain text and to deduce the permutations of the columns.

If the encrypted message is composed of very few words (1, 2 or 3) then an anagram solver can make it possible to find them.

The transposition cipher is, along with the substitution cipher, one of the most used bricks for more elaborate ciphers. There are dozens of ciphers that use it like ADFGVX, Amsco, Double Transposition, Redefence, etc.

The empty squares of the grid introduce an additional difficulty, rather time-consuming, when deciphering. Because the receiver of the message must calculate the position of these, which requires among other things, to count the number of characters of the message. If the empty boxes are not completed and the pre-calculation is not done, errors could appear in the reorganization of certain letters (especially the last ones).

dCode retains ownership of the "Transposition Cipher" source code. Except explicit open source licence (indicated Creative Commons / free), the "Transposition Cipher" algorithm, the applet or snippet (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, breaker, translator), or the "Transposition Cipher" functions (calculate, convert, solve, decrypt / encrypt, decipher / cipher, decode / encode, translate) written in any informatic language (Python, Java, PHP, C#, Javascript, Matlab, etc.) and all data download, script, or API access for "Transposition Cipher" are not public, same for offline use on PC, mobile, tablet, iPhone or Android app!

Reminder : dCode is free to use.

The copy-paste of the page "Transposition Cipher" or any of its results, is allowed (even for commercial purposes) as long as you cite dCode!

Exporting results as a .csv or .txt file is free by clicking on the *export* icon

Cite as source (bibliography):

*Transposition Cipher* on dCode.fr [online website], retrieved on 2023-05-31,

- Transposition Decoder
- Transposition Encoder
- How to encrypt using a Transposition cipher?
- How to decrypt with a transposition cipher?
- How to recognize a transposition ciphertext?
- How to decipher a transposition cipher without key?
- What are the variants of the transposition cipher?
- Why completing the empty cells of the transposition table?

transposition,column,permutation,anagram,disorder,grid,rectangle,rectangular

https://www.dcode.fr/transposition-cipher

© 2023 dCode — The ultimate 'toolkit' to solve every games / riddles / geocaching / CTF.

Feedback