# Question: (1 point) A cryptography student has accidentally used the same – Free Chegg Question Answer

Transcribed text From Image:

## Expert Chegg Question Answer:

Answer:

## Answer

If the two encrypted messages have been encrypted using the same keystream, then we can easily recover the messages using bitwise XOR:

(C1 XOR C2) results in (M1 XOR M2)

Once we get (M1 xor M2) we can easily recover M2 since we already know M1. All that we need to do is another XOR with M1.

These 2 steps can be performed in any programming language, the below code shows the XOR operations done using python:

C1 = 0xd6ac2007e2db590a

C2 = 0xabe5b7c8c6b5d7de

#Performing bitwise XOR on C1 & C2 by ^ operator

temp = C1 ^ C2

M1 = 0xb8ef7a668d06aa00

M2 = temp ^ M1

print(hex(M2))

**Result (M2):**

**0xc5a6eda9a96824d4**

Similarly, the keystream can be recovered by doing XOR on any Ciphertext & corresponding message:

keystream = C1 ^ M1

This gives keystream = 0x6e435a616fddf30a

**(*Please up-vote. If any doubt, please let me know in the comments)**