1

Say you have a file that is not random, and you XOR every bit with a random bit (not pseudo, but really random). Can someone who sees only the result extract any information from it? Obviously, it won't be 100% accurate, but I imagine you can do some sort of stochastics and get a vague idea. If yes, how? If no, is there a mathematical proof?

Mike Edward Moras
  • 18,161
  • 12
  • 87
  • 240
not sure
  • 11
  • 1

2 Answers2

4

This cipher is called a one-time pad. It is unbreakable ("perfect secrecy") assuming that:

  1. The pad (the collection of random bits) really is truly random
  2. The pad is never reused to encrypt other messages

So, no information can be extracted from $\text{file} \oplus \text{random bits}$.

The basic idea of the proof is that an attacker can test every possible key, but they have no way of knowing which plaintext is actually correct. If I encrypt "attack" with a one-time pad, then any six-character string could just as equally have been encrypted in the first place.

Reid
  • 6,879
  • 1
  • 40
  • 58
-2

If the file has been crafted deliberately to survive this form of damage then yes you should be able to recover your data.

There are many quite simple methods from adding CRCs to replicating the data multiple times.

There are other possible routes to recovery. If for example the file was an ASCII text file then it may be possible to recover something close to the original data by reasoning and dictionary work.