Say you have a 1,000,000 random bytes file and you split it into 1000 x (1000 bytes) pieces.

You then pick two random pieces and swap them writing down the position of the pieces (eg. swapped piece 34 with piece 457).

You repeat the process 1000 times at least.

Is it possible for somebody else to recover the original file without any other information but the scrambled file ?

What if multiple files encrypted like this (using the same permutation) are intercepted, how difficult is it then to decrypt them ?

  • $\begingroup$ @Maarten Bodewes: what exactly do you mean by " just return the ciphertext". Swapping is a very cheap operation so you could consider a very high number of swapping operations. I mentioned multiple files because I am thinking they could help in reverting the permutations somehow. $\endgroup$ Mar 7 '17 at 11:20
  • $\begingroup$ If you consider 1000 pieces of which you swap random 2 pieces a 1000 times then there is a considerable chance that some pieces never get swapped at all. So in that case the piece at location x in the "ciphertext" is identical to the piece at location x in the plaintext. So if an attacker has to guess the plaintext he can just return the ciphertext; in that case the attacker would at least guess a few locations correct. So the probability of guessing at least a few pieces correct this way is higher than expected for a good transposition cipher. $\endgroup$
    – Maarten Bodewes
    Mar 7 '17 at 15:06
  • 1
    $\begingroup$ There are definitely better ways of shuffling a list though, which is basically what you are doing. PS you are better off writing comments below my answer, those I see directly, this one I just found by re-reading the question. $\endgroup$
    – Maarten Bodewes
    Mar 7 '17 at 15:09

This is basically just a single transposition cipher. The key to the transposition cipher would be a list of the source and destination locations, or just a list of final destinations of the blocks. It's not a very good one because it may well be that you do not swap certain blocks or that you swap something back and forth a few times.

It is not possible for somebody to recover the original file with any kind of certainty. This is not because of the cipher but because a file filled with randoms has no distinguishable information; even if the attacker would guess the key correctly, there is no way for the attacker to verify the result.

It would be easy to guess a few of the blocks right though: just return the ciphertext. The blocks are not shuffled that well, so chances are some of them never changed position; this chance for each block is higher than 1/1000 making the cipher insecure.

For multiple files just containing random information the chances of each file is the same as for a single file. If they were somehow interrelated then the contents would not be random. QED.

(Of course if you'd guess the location of one block right for the first file you'd guess them right for all of them when using the same permutation, but again, no way to verify this.)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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