# XOR and key reuse [duplicate]

I've been doing a bit of reading on the use of XOR and the dangers of key reuse. I'm aware that reusing a key can open a door for a frequency analysis attack on my plain text. So far, everything that I've seen indicates that a frequency analysis attack depends on there being "plain text". The thought being that languages contain recognizable patterns. My question is, what if I'm not encrypting "plain text", but instead two strings of random bits AND both strings are the same length? Does the re-use of one of the input strings multiple times open any doors for attack on my "key"?

For example:

ddd03719f390695784b92d4a3182212b3370e997 ⊕ 910e10bb9bcb27f77a151aea866d2c27a2cd9c1c = 4cde27a2685b4ea0feac37a0b7ef0d0c91bd758b
f4b2d44fbe5cfb7f00e60a2293d8a78c443a0ed5 ⊕ 910e10bb9bcb27f77a151aea866d2c27a2cd9c1c = 65bcc4f42597dc887af310c815b58babe6f792c9
02bb44aa8760fdb77312b1dfaef923511531374a ⊕ 910e10bb9bcb27f77a151aea866d2c27a2cd9c1c = 93b554111cabda400907ab3528940f76b7fcab56
153a43bec8e0c22cf84988ee90a5444accf5834f ⊕ 910e10bb9bcb27f77a151aea866d2c27a2cd9c1c = 84345305532be5db825c920416c8686d6e381f53
267611d396dca3f8abfd175f1c39672c7e2791cb ⊕ 910e10bb9bcb27f77a151aea866d2c27a2cd9c1c = b77801680d17840fd1e80db59a544b0bdcea0dd7
fc369b0d1e71ce4455429e09a4238964f855fc50 ⊕ 910e10bb9bcb27f77a151aea866d2c27a2cd9c1c = 6d388bb685bae9b32f5784e3224ea5435a98604c
6b57433b12683ea7eb298954a5130e07e183c3cc ⊕ 910e10bb9bcb27f77a151aea866d2c27a2cd9c1c = fa59538089a31950913c93be237e2220434e5fd0
be7fc6a4b469e1cb8893f8a57c86c2e2f54452cd ⊕ 910e10bb9bcb27f77a151aea866d2c27a2cd9c1c = 2f71d61f2fa2c63cf286e24ffaebeec55789ced1
3f71388bb4916dfc60a8b6ce4ab50ee9850e6c6c ⊕ 910e10bb9bcb27f77a151aea866d2c27a2cd9c1c = ae7f28302f5a4a0b1abdac24ccd822ce27c3f070
7387fae00b77b4a00224e549903e2121af421cff ⊕ 910e10bb9bcb27f77a151aea866d2c27a2cd9c1c = e289ea5b90bc93577831ffa316530d060d8f80e3
edce4e194e97cc39d593928e6e2cd7be27de276b ⊕ 910e10bb9bcb27f77a151aea866d2c27a2cd9c1c = 7cc05ea2d55cebceaf868864e841fb998513bb77


Where each column is expressed as base16 for simplicity, the first column is derived from various inputs, the second is the data I'm trying to secure. Is it possible to derive either of the inputs using any, some or all of the outputs?

Thank you!

## marked as duplicate by kelalaka, AleksanderRas, Maarten Bodewes♦ encryption StackExchange.ready(function() { if (StackExchange.options.isMobile) return; $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() { var$hover = $(this).addClass('hover-bound'),$msg = $hover.siblings('.dupe-hammer-message');$hover.hover( function() { $hover.showInfoMessage('', { messageElement:$msg.clone().show(), transient: false, position: { my: 'bottom left', at: 'top center', offsetTop: -7 }, dismissable: false, relativeToBody: true }); }, function() { StackExchange.helpers.removeMessages(); } ); }); }); Aug 15 at 23:36

You've constructed a (somewhat artificial) special case where what you call the "plaintexts" also meet the requisites that one-time pad keys are supposed to meet:

• Secret
• Chosen uniformly at random
• Never reused

So we can analyze this by flipping the labels, so that we regard what you label the "key" and the "plaintexts" the other way around, and the theorems about one-time pad security apply. So your assumptions about what you call the "plaintexts" guarantee the confidentiality of what you call the "key."

If an attacker knows the ciphertexts, then they can XOR two ciphertexts together to know the result of XORing two plaintexts together. If the plaintexts had predictable content, then the obvious next step for the attacker is to do crib-dragging, but they can't if the plaintexts themselves are purely random. However, that's not the only way this knowledge is helpful to them.

• If an attacker later learns any of the plaintexts, then they can figure out the rest of the plaintexts from that. (In a strong encryption system, knowing some plaintext+ciphertext pairs is no help at all in decrypting other ciphertexts encrypted with the same key.)
• If you accidentally published the plaintexts out of context, the attacker can recognize that the values probably are the plaintexts of the ciphertexts they collected because they have the same XOR results as the ciphertexts. (In a strong encryption system, it's impossible for an attacker to tell whether or not a ciphertext corresponds to a specific plaintext value.)

I don't expect this list is exhaustive. It would be incorrect to read these examples, decide that you're able to abide by the specific restrictions these scenarios imply, and then decide that must mean XOR key reuse is completely safe. Strong encryption doesn't cost anything and good libraries are widely available. They should always be the default choice over trying to hand-roll an encryption system.