0
$\begingroup$

If i have say 64 bytes, can i XOR those bytes with another 64 random bytes, and have two new arrays, where both are needed to reconstruct the first?

Intuetively i need some symmetric encryption like AES, but i cant figure out how the XOR above can be attacked. Does the content matter?

$\endgroup$
  • $\begingroup$ Have you ever consider generating a random 65 byte then xor like in OTP? $\endgroup$ – kelalaka Jun 11 '20 at 19:54
  • $\begingroup$ It's secure if you do it a single time with each key. If you reuse the same key, it is weak. $\endgroup$ – bmm6o Jun 11 '20 at 20:42
1
$\begingroup$

If i have say 64 bytes, can i XOR those bytes with another 64 random bytes, and have two new arrays, where both are needed to reconstruct the first?

This is known as XOR secret sharing or in the case of two splits also known as a the (binary) One-Time-Pad.

Indeed if for every execution of the split-up operation a new independent random string is used then always both (/all) shared parts are needed for reconstruction. Any less number of shares / parts leaks no information about the shared message except for the length and what was already known anyways.

Note though that this provides no protection against tampering, i.e. if somebody flips a bit in either share and the other(s) doesn't then the reconstructed message will have the bit flip without a strong cryptographic guarantee of this being noticed.

Also note that security breaks down horribly if the same randomness is used with two different messages. Of course if you re-use randomness for the same message then an adversary can notice that.

$\endgroup$
  • $\begingroup$ Thank you, fascinating, I can explain that to a 10 year old, but not AES :) $\endgroup$ – BobbyTables Jun 11 '20 at 22:23

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.