-1

I have 20 OTP ciphertexts which I know were encrypted with only 19 distinct keys, so 1 key has been reused. Also only two different messages, with the same length, were encrypted.

I know that if I xor two ciphertexts together , if they share the same key, i'll eliminate the key. So I did, with all of them. But now I can't manage to discover which pair is the one who shares the key.

Can someone help me and tell me how to distinguish the pair that shares the key from the others?

mbp
  • 28
  • 6
  • 1
    Is this homework? What do you know about the plaintext? The problem is impossible if the plaintext is indistinguishable from random (conceptually: the plaintexts could be considered keys used to encrypt 20 messages, two of which are identical). – Thomas M. DuBuisson May 04 '13 at 00:11
  • Yes, this is homework. The plaintexts are 2 english messages of the same length with no spaces. So the plaintext is distinguishable from random. I have xored all ciphertexts together in pairs. One pair should be distinguishable from the others because it is a xor of two plaintexts with no key. I just can't spot the difference. – mbp May 04 '13 at 01:06
  • I'm not sure what I can say that you don't already know. The answer should be apparent - particularly if the plaintext is alpha-numeric 8 bit ASCii... – Thomas M. DuBuisson May 04 '13 at 04:36
  • @ThomasM.DuBuisson I've answered the question as it has become apparent to me that something like ASCII encoding is not that well known to many programmers anymore. Any programming book in my time contained an ASCII table, but those days have long gone :) – Maarten Bodewes May 04 '13 at 09:28
  • This question is probably better asked over on http://crypto.stackexchange.com/ – Chase Florell May 04 '13 at 16:01
  • @ThomasM.DuBuisson The plaintext is indeed alpha-numeric 8 bit ASCii, but it only uses the capital letters, no numbers nor symbols. Btw, the ASCII table is still around in nowadays programming books :) I'll try to figure it out and I'll share my answer. Thank you for your help. – mbp May 05 '13 at 21:25
  • @ChaseFlorell I'll ask it over there. Thank you. – mbp May 05 '13 at 21:27

2 Answers2

1

XOR the ciphertext together to eliminate the key as you suggest. The result will be two plain texts XOR-ed together.

Now it becomes a matter of detecting a pattern within this data. It is possible to do this by examining the encoding. ASCII letters always have a certain bit pattern, e.g. 'A' is 41 in hexadecimals or 0100 0001 in binary and 'a' is 61 in hexadecimals or 0110 0001. So if XOR'ed together you will get something like 0010 0000. Notice the high number of bits set to zero. Also note that two ASCII encoded letters XOR-ed together will start with two zero valued bits.

Finally, text uses a lot of spaces, which are encoded using the value 20 in hexadecimal or 0010 0000 in binary. When XOR-ed with any letter it will return a different case, but the result will still be a letter. When XOR-ed with itself it will become a 0000 0000 binary value (just like any character encoding XOR-ed with itself).

With enough ciphertexts it is possible to get the plain text and the key; with just 2 ciphertext this is probably not attainable. That's probably the next assignment.

Maarten Bodewes
  • 90,524
  • 13
  • 150
  • 263
0

One idea is to eliminate the key as you describe using XOR and then XOR the result with something that one of the plainttexts is likely to contain and examine the output.

A.E. Drew
  • 2,097
  • 1
  • 16
  • 24