# OTP - Why not reuse key? EDITED! [duplicate]

This might sound really dumb but why is it bad/insecure too use the same key twice on One-time-pad?

Question: Why and how does using a key twice make it insecure. (in One-time-pad).

EDIT: I have read the "maybe" duplicated ones but they did not have the same perspective as this quesiton.

EDIT: But what if I use extra key? Can the reused cipher text be saved? We say if you had a plaintext (5) and a key (6) you would do 6 + 5 + 127 mod 127 to get the cipher text and next time you will use the key again but with extra key and the extra key will be added exactly like the key (6 + 5 + "extra key" + 127 mod 127). Every time you encrypt a text the key will be the same. The extra key would be the same on every character you encrypt but will be changed every transmission.

Is that secure then?

• Comments are not for extended discussion; this conversation has been moved to chat. Feb 7, 2018 at 1:42

First, you wouldn't call it a one-time-pad any longer if you reused the key.
Second the security of the OTP can only be proven if the key is as long as the message. (which wouldn't be the case if you'd reuse a key)
Third, OTP usually use XOR operation to combine key and message. If the key is never reused, you're safe, but if an attacker can mount a known plaintext attack, he can get part of your keystream and decrypt anything that was encrypted using this part of the keystream.
Fourth, as soon as you start repeating the key stream an attack can even notice that in a ciphertext only attack as he can simply xor both cipherexts ($c_1=k\oplus m_1 \wedge c_2=k\oplus m_2 \Rightarrow c_1\oplus c_2 = k\oplus k\oplus m_1 \oplus m_2 = m_1 \oplus m_2$) On this an attacker can event mount a simple frequency analysis.

EDIT TO ANSWER THE EDIT:

Even after your edit the scheme is still breakable. Observer that the following equations hold (I omitted the (mod n)):

• $m_1+k_1+IV_1=c_1$ (first message, first letter)
• $m_2+k_1+IV_2=c_2$ (second message, first letter)
• $m_3+k_2+IV_1=c_3$ (first message, second letter)
• $m_4+k_2+IV_2=c_4$ (second message, second letter)

Now observe that you can formulate the following equations:

• $c_2-c_1=(IV_2-IV_1)+(m_2-m_1)$
• $c_4-c_3=(IV_2-IV_1)+(m_4-m_3)$

Finally you can construct the relation: $(c_4-c_3)-(c_2-c_1)=(m_4-m_3)-(m_2-m_1)$.

Now as you've got a nice relation between $c$ and $m$ you can analyze the data you gather and see how well you do with frequency analysis (again this is ciphertext-only, known-plaintext would be easier)

EDIT 2 TO ANSWER THE REFORMULATED QUESTION (COMMENTS):

Even after your edit the scheme is still breakable. Observer that the following equations hold (I omitted the (mod n)):

• $m_1+k+IV_1=c_1$ (first message, first letter)
• $m_2+k+IV_1=c_2$ (second message, first letter)
• $m_3+k+IV_2=c_3$ (first message, second letter)
• $m_4+k+IV_2=c_4$ (second message, second letter)

Now observe that you can formulate the following equations:

• $c_2-c_1=(m_2-m_1)$
• $c_4-c_3=(m_4-m_3)$

Now as you may see, this is exactly the same problem as with the above mentioned XOR construction. You can again perform frequency analysis to break this ciphertext-only or use this relations to break it with known plaintext.

• Comments are not for extended discussion; this conversation has been moved to chat. Feb 7, 2018 at 1:41