0
$\begingroup$

I have been given three different strings:

1~p-otq{dsYBKTD;L?=,?6W'?66h_kcvY(:Z4ipq,%CHT<HHAI
+0o"j'wyr'gX1DIH?XF*8,KX;F:|__qqQ'Gownkvoe9ED^Y)3m{)ly|!!ky*
*u%8zoq+vt=K=IS<F:?H4:Wy.&0VmrjhM(>4'gyrmv!82

I have converted these to HEX using this website, so I am now left with:

317e702d6f74717b647359424b54443b4c3f3d2c3f3657273f3636685f6b637659283a5a346970712c254348543c48484149
2b306f226a27777972276758314449483f58462a382c4b583b463a7c5f5f71715127476f776e6b766f653945445e5929336d7b296c797c21216b792a
2a7525387a6f712b76743d4b3d49533c463a3f48343a57792e2630566d726a684d283e34276779726d76213832

Using cribdrag, I XOR each one with its corresponding string using xorstrings.py

python xorstrings.py 317e702d6f74717b647359424b54443b4c3f3d2c3f3657273f3636685f6b637659283a5a346970712c254348543c48484149 2b306f226a27777972276758314449483f58462a382c4b583b463a7c5f5f71715127476f776e6b766f653945445e5929336d7b296c797c21216b792a

python xorstrings.py 317e702d6f74717b647359424b54443b4c3f3d2c3f3657273f3636685f6b637659283a5a346970712c254348543c48484149 2a7525387a6f712b76743d4b3d49533c463a3f48343a57792e2630566d726a684d283e34276779726d76213832

python xorstrings.py 2b306f226a27777972276758314449483f58462a382c4b583b463a7c5f5f71715127476f776e6b766f653945445e5929336d7b296c797c21216b792a 2a7525387a6f712b76743d4b3d49533c463a3f48343a57792e2630566d726a684d283e34276779726d76213832

I then use cribdrag.py as follows:

python cribdrag.py 1a4e1f0f0553060216543e1a7a100d7373677b06071a1c7f04700c1400341207080f7d3543071b0743407a0d106211617224 -c "a-zA-Z0-9.,?! :;'\"_\[\]#"

python cribdrag.py 1b0b5515151b005012076409761d17070a0502640b0c005e1110063e3219091e1400046e130e09034153627066 -c "a-zA-Z0-9.,?! :;'\"_\[\]#"

python cribdrag.py 01454a1a1048065204535a130c0d1a74796279620c161c2115600a2a322d1b191c0f795b500912040213187d76 -c "a-zA-Z0-9.,?! :;'\"_\[\]#"

I have a bunch of strings I believe are in at least one of the messages. The issue is, I am not sure how to proceed.

Let's say for the third one, I search for: ENCRYPTION, I get the following

*** 14: "_::0 2X_So"
*** 22: "YoV2SzfdTW"
*** 23: "d[#XsbyRVR"

If I try the other two, I would expect at least one of them to be present in the other two, at the same position-- but they are not. So, let's say I try another one. Using one those values, I get the following results, which you can see are all at different positions:

Please enter your crib: _::0 2X_So
*** 11: "VL'''8]]7d"
*** 21: "S:d!04fmJf"
*** 31: "A.:4N!VVP."

Please enter your crib: YoV2SzfdTW
*** 1: "R:C'Hz6vS3"
*** 16: "SjTVXvf:EG"

Please enter your crib: d[#XsbyRVR
*** 2: "1N6Cs2kU2["
*** 27: "Zi:QmvyV8A"

I have tried Encryption, encryption and ENCRYPTION with no luck. I have tried all the other words I can think of.

Have I taken the correct approach, or has a fundamental mistake been made?

I've tried the method seen below--no luck. My crib got me nowhere.

from itertools import combinations
crib = "encrypt".encode("hex")
binary_a = '1~p-otq{dsYBKTD;L?=,?6W\'?66h_kcvY(:Z4ipq,%CHT<HHAI'
binary_b = '+0o"j\'wyr\'gX1DIH?XF*8,KX;F:|__qqQ\'Gownkvoe9ED^Y)3m{)ly|!!ky*'
binary_c = '*u%8zoq+vt=K=IS<F:?H4:Wy.&0VmrjhM(>4\'gyrmv!82'

L1=[binary_a,binary_b,binary_c]

def xor_strings(xs, ys,i=0):
    return "".join(chr(ord(x) ^ ord(y)) for x, y in zip(xs[i:], ys))

def initial_drag(crib):
    for cipher in L1:
        for position in range(len(cipher)-len(crib)):
            key = xor_strings(cipher,crib.decode("hex"),position).encode("hex")
            for c in L1:
                print xor_strings(c,key.decode("hex"),position),position
            print ""


initial_drag(crib)
$\endgroup$
8
  • $\begingroup$ When you x-or two OTP messages that reuse the keystream, you get only the XOR of two messages, when you try all locations with the guessed keyword, you may see a meaningful text on the x-ored positions, but this doesn't mean that the guess keyword ( or given) must have to be in all. The easiest and correct approach is using the 3 all together. $\endgroup$ – kelalaka Feb 15 at 18:37
  • 1
    $\begingroup$ I don't think there is too much wrong with your approach, but _::0 2X_So is clearly not a good result. It might be the best, but it doesn't look like plaintext to me. $\endgroup$ – Maarten Bodewes Feb 15 at 21:25
  • $\begingroup$ Thank you @MaartenBodewes. Agreed, it doesn't look at all like what I am after. I have several words to look for and none of them really work. $\endgroup$ – pee2pee Feb 15 at 21:51
  • $\begingroup$ @kelalaka how would I use all 3 together? $\endgroup$ – pee2pee Feb 15 at 21:53
  • 2
    $\begingroup$ I don't know, I would try and use a smaller crib first, like "the" and go from there. Once you get a good hint you can expand. $\endgroup$ – Maarten Bodewes Feb 16 at 8:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.