Columnar Transposition Cipher

12345
THISI
SASEC
RETME
SSAGE

A columnar transposition cipher is a cipher that encrypts the plaintext by shuffling the order of the characters in the message through transposing the columns. to encrypt the message you need the plaintext, a chosen number of columns, and a key. The characters of the plaintext are then placed into a row, with a new row being made when the number of characters in the row reaches the number of columns chosen. Usually, whitespace and punctuation will be removed from the message at this point. An example of this is shown below with the plaintext "This is a secret message" and a column width of 5.

Once the plaintext is set up in the grid, the columns are reordered according to the key. Using a key of 53241, a new grid is made where column 5 is placed first, column 3 is placed second, and so forth until you have reordered the grid.

53241
IIHST
CSAES
ETEMR
EASGS

The columns are then written out one at a time starting from the left and working down. Placing the now reordered text back into a single string, we end up with our ciphertext: "ICEEISTAHAESSEMGTSRS". To decrypt this ciphertext, we would need to place the encrypted message into a grid with the same number of columns, label each column with the key, and then reorder it back into 12345 order.

Key:
Columns:
Plaintext:
Ciphertext: