Can i XOR an array of bytes with an equal length key securely 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?
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.