Leandro Junes

Columnar Transposition

Rearrange text using keyed columns.

Write the message across rows, then read the columns in the order determined by a keyword. This is a transposition cipher: it changes the positions of characters, not their identities.

Calculator

—
Mode

Key tools

The columns in the order they are read, counted from the left starting at 1. Entering an order directly uses it as the key, with no keyword.

Grid filling
Text interpretation

Column grid

—

How was this decrypted?

How does the keyword determine column order?

Each letter of the keyword heads a column. Sort the letters alphabetically: the place of each letter in the sorted keyword is the rank of its column, and the columns are read in the order of their ranks. The keyword only serves to remember that order.

Why are repeated keyword letters allowed?

Every letter of the keyword is a column, so a repeated letter is kept: dropping it would change the number of columns. When two columns have the same letter, the one further left is read first. That makes the order definite whatever the keyword.

What is the difference between padded and irregular transposition?

A message rarely fills its last row. Irregular transposition leaves that row short, so some columns are one character longer than others. Padded transposition completes the row with a filler letter, so that the grid is a full rectangle and every column has the same length.

After decryption the padding is still there. Padding cannot always be distinguished from genuine message characters, since a message can really end in X, so this page marks what may be padding and removes nothing.

How is the message decrypted?

The shape of the grid depends only on the length of the text and the number of columns. Dividing the length by the number of columns gives the full rows; the remainder says how many columns, counted from the left of the grid, have one character more. Those lengths go by where a column stands in the grid, not by its rank.

The ciphertext is then cut into stretches of those lengths in the order the columns were read, each stretch is written down its column, and the rows are read from left to right. In Encrypt and Decrypt mode the first collapsed section shows these steps for the current text.

Why is this cipher vulnerable?

The letters are all still there; only the column order is secret. For a short key every order can be tried. For a longer one, the right order betrays itself little by little: putting two columns side by side correctly makes every row join in a likely pair of letters, so an attacker can improve a guess step by step instead of trying everything.

Rail Fence follows a zigzag path, while Columnar Transposition uses a keyword to determine the order in which columns are read. Both move letters without changing them; the Substitution, Vigenère, Playfair and Hill ciphers change the letters instead.