# OTP - Reuse key BUT add IV, is it secure enough?

I have already asked a similar question and now I can continue to this question about adding a "extra key" = IV.

My last question was about reusing key in OTP (One-Time-Pad). Now this question is about reusing same key BUT adding a "extra key" = IV.

Question: Is this algorithm below safe to use? (Reusing key BUT adding IV)

Sending the first message:

• $character_1 + key_1 + IV_1 = cipher_1$
• $character_2 + key_2 + IV_1 = cipher_2$

Pay attention to the little number under the objects, example: $IV_1$ it defines which one it will use of a specified group/object.

Sending the second message:

• $character_3 + key_1 + IV_2 = cipher_3$
• $character_4 + key_2 + IV_2 = cipher_4$

In the first message I send I used different keys in all of the characters BUT the same IV. Does it make it insecure?

In the second message I send I use different keys in all of the character BUT the keys where SAME AS THE MESSAGE ONE, but I used a different IV this time. Does it make it insecure?

My goal is to make OTP not "One-time", instead of generating a WHOLE sequence of keys you just change the IV every time you send a message. So, is this insecure?

EDIT: REUSING KEY IS SECURE!

I have questioned before about my own invention: Reusing the same key BUT change the IV (extra key). MANY of you were against it and you sad it was insecure and I loosed hope.

Now with some mathematical proofs and ask again. Is this secure? Here is my mathematical journey to proof why this should be secure:

This is the standard OTP algorithm (XOR version) with a never-used key:

• $message_1 ⊕ key_1 = cipher_1$ (message one)
• $message_2 ⊕ key_2 = cipher_2$ (message two)

...and if you want to break it down it will look like this:

• $c_1 ⊕ c_2 = m_1 ⊕ m_2 ⊕ k_1 ⊕ k_2$

Note that this is a secure version of OTP because the keys are different and the attacker can not access the message without the keys, but if the keys where the same the attacker would easily get the message ($m_1 ⊕ m_2$) because of when you XOR two exactly same values the result will ALWAYS be 0 (nothing) so the key do nothing...

Now this is my version of OTP, please pay attention to the number below the objects (example: $c_1$).

My goal is to make OTP not "One-time", instead of generating a WHOLE sequence of keys you just change the IV every time you send a message. So, is this insecure?

So here is how the algorithm looks like:

Sending the first message:

• $character_1 ⊕ key_1 ⊕ IV_1 = cipher_1$
• $character_2 ⊕ key_2 ⊕ IV_1 = cipher_2$ (Note that the IV is the same but the keys are different so the keys are securing the message.)

Sending the second message:

• $character_3 ⊕ key_1 ⊕ IV_2 = cipher_3$
• $character_4 ⊕ key_2 ⊕ IV_2 = cipher_4$ (Note that I reused the key but I used a different IV that secures the message.)

In the first message I send I used different keys in all of the characters BUT the same IV. Now I will simulate me to be a attacker and try to attack the two messages that have the same key:

Pay attention to which cipher text I use, look up to match the message with the cipher-number below.

• $cipher_1 ⊕ cipher_3 = character_1 ⊕ character_3 ⊕ IV_1 ⊕ IV_2$

(Note that the cipher BOTH use the SAME KEY, but they remain secure because of the two different IV)

That attack was on two different messages that have keys in common now we will test to attack characters in ONE message that have IV in common.

• $cipher_1 ⊕ cipher_2 = character_1 ⊕ character_2 ⊕ key_1 ⊕ key_2$

Note that now the IV is matching and therefore useless BUT the keys remain different and the message is SECURE.

So I have proved that this algorithm (reusing same key but with a extra key) is safe. Now you don't need to change the key just change the IV.

Now when I have proven you why this is secure please analyse this and give me some weaknesses.

• Comments are not for extended discussion; this conversation has been moved to chat. – e-sushi Mar 7 '17 at 2:53

## 3 Answers

Simply put: No. First recall that this is a mis-use of the term "One Time Pad" So lets call it a Vigenère cipher instead. You can determine this is insecure with a simple algebraic combination:

$\text{attack} = cipher_1 + cipher_2 + cipher_3 + cipher_4 \\ \text{Simplify: } \\ \text{attack} = character_1 + key_1 + IV_1 + character_2 + key_2 + IV_1 + character_3 + key_1 + IV_2 + character_4 + key_2 + IV_2 \\ \text{attack} = character_1 + character_2 + character_3 + character_4$

If we rename your $IV_1, IV_2$ to simply $Key_3, Key_4$ then it becomes really clear that what is going on is just two vigenere ciphers with an odd sort of overlap.

• Comments are not for extended discussion; this conversation has been moved to chat. – e-sushi Mar 7 '17 at 2:54

This is not a mathematical proof. A notable place it fails to be a proof is here:

Pay attention to which cipher text I use, look up to match the message with the cipher-number below. $$cipher1⊕cipher3=character1⊕character3⊕IV1⊕IV2$$

(Note that the cipher BOTH use the SAME KEY, but they remain secure because of the two different IV)

This line is a fine example of begging the question. You state, without justification, that this is secure because you have two different IVs (and without clarifying the properties of those; you have to be very, very precise with terminology in real proofs). In fact, this can be secure, but only if the "IVs" are really secret keys as long as the message which are randomly chosen. In which case, you may as well drop your primary key, because your "IVs" are a normal one-time pad. If your IVs are not like that, you have to do an actual analysis based on how they're used. For instance, if your IVs are just repeated as many times as needed (so with a 20-bit IV you'd just repeat it for every 20 bits of message), you have $$c_1\oplus c_2 = p_1\oplus p_2 \oplus (IV_1 \oplus IV_2).$$

This is a Vigenere cipher, with period $\mathrm{lcm}(\lvert IV_1\rvert, \lvert IV_2\rvert)$. Vigenere ciphers are not very good; however, while a real proof would go into depth about why you imagine $p_1\oplus p_2\oplus IV_1\oplus IV_2$ is secure, you assert it is without further evidence. You do the same thing with the two-key scenario; while you're correct that with different keys it's secure, you need to justify that in an actual proof (or cite someone who did justify it). You might leave that out if no one challenges it; the two-key thing is fairly clear to a competent reader. The two-IV case is certainly not trivial, and any proof that skips over it is fatally flawed.

This is NOT secure. I have found the weakness with mathematics.

So this is our two messages:

Sending the first message:

• $character_1 ⊕ key_1 ⊕ IV_1 = cipher_1$
• $character_2 ⊕ key_2 ⊕ IV_1 = cipher_2$

Sending the second message:

• $character_3 ⊕ key_1 ⊕ IV_2 = cipher_3$
• $character_4 ⊕ key_2 ⊕ IV_2 = cipher_4$

Now see what happens if we XOR all of them:

• $cipher_1 ⊕ cipher_2 ⊕ cipher_3 ⊕ cipher_4 = message_1 ⊕ message_2 ⊕ message_3 ⊕ message_4$

That is the weakness of my invention. Thanks for everybodys time.