Definition
Columnar Transposition
Columnar transposition is a transposition cipher in which the plaintext is entered line by line into a matrix. The ciphertext is obtained by reading the matrix column by column in an order determined by a key.
Operation
The key is a list of numbers (of length , the number of columns) containing each number from to exactly once. Each column is assigned one key element, and the columns are read in the order specified by those elements.
Example
Encrypting with key 3, 1, 2, 5, 4
Plaintext:
THIS IS A TRANSPOSITIONThe plaintext is written row-wise into a 5-column matrix, and columns are read in the order determined by the key:
Key 3 1 2 5 4 T H I S I S A T R A N S P O S I T I O N Reading columns in key order (1, 2, 3, 4, 5) gives the ciphertext:
HSROOI ASNTITPI STSANI
Security
Brute-Force and Heuristic Attacks
Brute-force attacks are effective only for short keys, since the number of possible keys is . For larger keys, heuristic optimisation methods (e.g. hill climbing) can be applied. Decryption with partially correct keys produces partially correct text, which guides the search.