# breaking one-time pad with key reuse

Suppose I have the message $m_1 = \sf{i\ like\ dogs}$.

Suppose its one-time pad encryption with key $k$ is a given hexadecimal string of 22 characters.

How would I encrypt a message $m_2 = \sf{i\ like\ cats}$ with the same key $k$?

I was given a similar question (but with different messages). Firstly I observed that the hexadecimal ciphertext had twice the character count than the message, so I thought each message character was mapped to a hexadecimal string of 2 characters.

My problem is that I don't know how would the $\oplus$ of the one-time pad work in this situation (as the message is not binary), so I couldn't guess the key. Any idea on how this should work?

• I think $\oplus$ should be the same in the hexadecimal case. Two-character hex or a byte is just different ways to represent an 8-bit sequence. The $\oplus$ in one byte is similar to $\oplus$ the $\{0,1,2,...,F\}$ considering that each hex character represents 4-bit subsequence. – Weikeng Chen Jul 11 '18 at 4:39

It's fairly simple. 1st byte of $k$ in pseudo code is:-toAscii("i") XOR toBinary(1st hex pair). ASCII code of "i" = 105 as an example. Then repeat for the remaining bytes to obtain all of $k$.