A classical, transposition cipher. Reorders the plaintext letters. Every single-letter frequency is preserved unchanged.
Requires a block length , typically small, and a permutation as the secret key.
The bottom row gives for each input position in the top row. Here , , , , .
Key Space
For a fixed block length , every key is a permutation in . The key space has members. If is secret as well, the complete key space is the union of these spaces over the permitted block lengths.
Encryption
Split the plaintext into blocks of characters. Pad the final block with filler characters if it is short.
Within each block, the character at position moves to position .
- plaintext character at position in the block
- ciphertext character at position in the block
Decryption
The receiver knows . Within each block, position of the plaintext is read from position of the ciphertext.
This is encryption under the inverse permutation .
Attacking
Single-character frequencies in the ciphertext match the standard language distribution, since the permutation only moves characters. A ciphertext whose frequencies match the standard distribution but which does not decrypt as a substitution cipher points to a permutation cipher.
The attack recovers first, then .
Recovering the block length :
- A plaintext word that repeats at the same offset within its block is permuted the same way each time, so it produces an identical character group in the ciphertext.
- Measure the gap between the start positions of 2 such repeated groups. The gap is a multiple of .
- Take the gcd of several such gaps. That gcd is , or a small multiple of it.
Recovering the permutation :
- Cut the ciphertext into blocks of length .
- Try each of the candidate permutations, applying its inverse to every block.
- Keep the candidate that turns every block into readable text.
Worked Example
Key: , , , , . Plaintext GETTOTHECHOPPER splits into 3 blocks of 5: GETTO, THECH, OPPER.
Solution Reveal Hide
Encryption places at position within each block. For the first block:
- position 2
- position 4
- position 1
- position 3
- position 5
Reading positions 1 to 5: T, G, T, E, O.
The other 2 blocks follow the same rule.
THECHbecomesETCHH.OPPERbecomesPOEPR.
Ciphertext: TGTEOETCHHPOEPR.
Decryption reads from position of each block, recovering GETTO, THECH, OPPER.
Plaintext: GETTOTHECHOPPER.
The attack starts from ciphertext blocks with the block length unknown. With a longer message under the same key, a plaintext word repeating at the same offset within its block would produce an identical ciphertext group each time, letting the gcd of the gaps between occurrences recover , as described above. Once is fixed:
- Cut the ciphertext into blocks of 5.
- Each of the candidate permutations is applied in inverse to every block.
- The candidate , , , , turns every block into readable text and is kept.