AKLS As I mentioned earlier, I am learning about stream ciphers in the first week of my Cryptography course in Coursera. It is really good and I encourage anyone who is interested in mathematics to take it up. Trust me, you are going to fall in love with it.
Although I have had quite a few encounters with breaking stream ciphers in CTF events, the academic (especially, the mathematics) side of it, is quite amazing. This weeks optional programming assignment was to break a cipher-text encrypted by XORing with a random key. We are given 10 cipher-texts which are encrypted with the same key too. So, it is a classic case of multi-time-pad.
If you are not aware of how OTP (One Time Pad) works, I highly recommend reading up this wiki.
Essentially, what we are doing is, we XOR the cipher-texts with the target one to be decrypted, in pairs. Let C~i~ be the cipher-texts given and C~t~ be the target text to be decrypted. So, we generate 10 pairs of C~i~ ⊕ C~t~. But, we know that
C~i~ ⊕ C~t~ = M~i~ ⊕ M~t~
We know that the target text is in plain English language. So, we can make use of the redundancies in the language and ASCII itself (since, only certain range is printable ASCII) to attack parts of the cipher-text and reveal the plain-text. I had written up a simple script to facilitate the attack. It is commented and should be self-explanatory. You can look at the complete script here, if you want to.
Here is a screenshot since, I can’t stop myself from posting something without a picture attached to it.