Privacy Canada is community-supported. We may earn a commission when make a purchase through one of our links. Learn more.

# Columnar Transposition Cipher

##### Ludovic Rembert
Last Updated on January 1, 2024

A transposition cipher follows the principle of shifting characters in a standard, if not strict, system. The columnar transposition cipher does just that—it shifts columns of characters around to encrypt a message.

It’s quite a basic cipher that is easy to implement, yet it’s also easy to crack. However, when the cipher is combined with a substitution cipher, the encryption can become much more complicated and provide greater security than when used alone.

## Cipher Example

To implement the columnar transposition cipher, you need to take your plain text and align it in columns within a table. Each character will take up one cell of the table. The width of this table will be determined by a keyword which will help in the encryption process.

If we use the word “FOURTH” as the keyword, we’ll have a table of 6 columns.

Now, imagine we want to encrypt the message “We have been found. Escape.”. We’ll create our table as below.

Alternatively, we could fill out the final row with random characters as seen below.

To encrypt the message, we simply shuffle, or transpose, the columns so the letters of our keyword are arranged alphabetically.

Then, to print the ciphertext, we’ll read from the top down. The encrypted message is spelled out as “wbuaeoceenpanevfshede”.

### Implementing the Columnar Transposition Cipher

For those interested in trying to implement the cipher, pychipher is a library that makes encryption effortless.

First, you must import ColTrans. Then, you can run the following.

ColTrans(“HELLO”).encipher(We have been found. Escape)

wbuaeoceenpanevfshede

ColTrans(“HELLO”).decipher(‘wbuaeoceenpanevfshede’)

wehavebeenfoundescape’.

### Cryptanalysis

Breaking the columnar transposition cipher by hand is not without difficulty, but it is possible. Cryptanalysis of any encrypted text often lies on principles of text characterization, frequency of letter usage, and other systems that define language usage.

If you know a ciphertext was encrypted using columnar transposition—and not with any substitution cipher added in—you’ll want to use anagramming. Here, you’ll shift around the ciphertext until you can find anagrams of common English words.

If you can find a few anagrams, you may be able to crack the transposition pattern used.

### The Bottom Line

By itself, the columnar transposition cipher has little utility in the modern world. However, it was used in conjunction with other ciphers until the mid-1900s for practical purposes. Today, modern computers would be able to crack such combined ciphers with little time or energy spent.