Let's say, I've got N strings encoded with "random" bytes using xor.

If I know that the information encoded is the same everywhere, is it possible for me to get at the information itself by doing some sort of manipulation with the data?

I've tried this with 3 strings (xor them with each other and than try to solve equations to get at the random bytes values) and to me it looks like it's impossible. Can anyone confirm or deny this?

  • What do you mean by "the information encoded is the same everywhere"? That all String1 XOR Rand1 = X, String2 XOR Rand2 = X, ... StringN XOR RandN = X ? Or are the N strings the same? Commented Jan 17, 2013 at 9:03
  • String1=String2=String3=...=StringN Commented Jan 17, 2013 at 9:11
  • Okay. In ciph = o1 XOR o2, the only way you will get back to the original is to again XOR the result (ciph) with one of the operands (o1 or o2). Commented Jan 17, 2013 at 9:24

1 Answer 1


No, this is not possible. Encoding a message using XOR and a key of equal length, randomly chosen from a uniform distribution, leaves you with a ciphertext that is equally likely as any other possible ciphertext, regardless of what the original message was. Therefore, without knowledge of the key, the encoded message tells us absolutely nothing about its secret.

The security is not compromised by running the algorithm again. It will yield a second number whose probability is also evenly distributed and more importantly, independant of the first ciphertext, as long as the keys are chosen independantly, even if the message is the same. Once again, these two numbers are equally likely as any other possible combination of two ciphertexts, regardless of the original message. So here too, the message stays a secret.

In fact, if this were not the case and multiple versions of the same message, but encoded with different keys, did reveal information, breaking the encryption would be trivial, even with only one ciphertext. An attacker could easily make more, by XOR'ing the ciphertext with another number, as this is equivalent to XOR'ing the message with a different random number.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .