I'm reading from Cornell , I know for a single permutation, I can find the ciphertext length (100), divide in some key lengths (10x10, 5x20), then try all permutation (10x9x8... 5x4x3x2x1). then find anything legible.

Is there any case the above method will not work, and is there any better method to crack this permutation cipher?

Also, what if I use two-permutation patterns, for example; for the 100 plaintext length:

  • I divide it into 10 characters per column.
  • Then for the first 4 characters - I use one permutation.
  • For the next 6 characters, I use another permutation.

Am I right that this makes no difference on the cracking step? i.e. I tried 10x10, then I tried all permutations 10! I will find anything legible.

  • $\begingroup$ Using 2 permutations is identical to using 1 permutation that doesn't shuffle as well. It actually makes it easier to break the transposition. $\endgroup$
    – Serpent27
    Sep 27, 2020 at 18:30
  • $\begingroup$ Also, the method you propose works in every case, but it's not the best solution. You can actually break such ciphers trivially, even for large plaintexts. I outline such an attack in my answer. $\endgroup$
    – Serpent27
    Sep 27, 2020 at 18:32

1 Answer 1


While transposition ciphers may move bits around, they are entirely linear; and effectively perform substitution... except the data positions are substituted, instead of the values.

Let's say I have the ciphertext


and I encrypt it to get


Statistical analysis becomes even easier than with a substitution cipher: I simply look for a word or set of words with the same count of each letter. Once I have a set of possible plaintexts (there won't necessarily be only 1 match) I effectively have a reduced set of possible plaintexts, one of which forms a known plaintext.

If I have the next ciphertext block as


I can perform the same attack on the next block, effectively creating a series of anagrams. In fact, this attack is so simple that it's already been implemented on every online anagram solver.

I might find multiple choices choices with meaning:

  • raspberry pi
  • raspberry ip

Since one makes more sense than the other, you know what your message is. This principal can be applied indefinitely to break transposition ciphers without even needing to break the key.

  • $\begingroup$ but if raspberrypi (removed space), then key one, ras -> sar, key two: pberrypi-> ipyrrebp. So, the ciphertext is saripyrrebp, then it is hard to loook for a word without knowing the space. then the only way is still try all possible key length 1..2..11.., then try all combinations of each key length, say, key length =11, then all combinations 11! to find that saripyrrebp is raspberrypi? $\endgroup$ Sep 28, 2020 at 15:31
  • $\begingroup$ The space becomes irrelevant to the difficulty of the attack. There's a multiple-word anagram solver here that proves how easy is is to break. Anagrams have been used for hundreds of years and have long since become nothing more than fun little puzzles to for bored old people. They'll even try anagrams of entire sentences if they're really ambitions. In the end, the attack doesn't even care about the presence of a space, since it simply guesses possible plaintexts until one starts to make sense. $\endgroup$
    – Serpent27
    Sep 28, 2020 at 19:44
  • $\begingroup$ The entire attack, if you check partial plaintexts as a means of optimization, takes about $O(n^2)$ time for an $n$ word message. Even if you have 100 words, that's still computationally quite easy... Although maybe not on a web browser in JavaScript. If you'd like to know more about what I'm describing I will be updating my answer soon to explain in more detail. $\endgroup$
    – Serpent27
    Sep 28, 2020 at 19:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.