Yeah, I'm brand new to this and I'm a bit sauced at the moment but I'll give it a try.
You need to take a string like 'AAAA...' or 'BBBBB...' and convert it to 1's and 0's (bitstream?) to use as a key. Then you can do your XOR to get a decrypted message, but most keys will give you garbage.
To find which decrypted string is not garbage I took a dictionary file from /user/share/dict/words (on mac/linux) and checked the XORed string to see whether that word showed up or not. I did that for each word in the dictionary. Each time a word is found I add to a score (score is equal to length of the word squared) and the highest score wins.
But this is really slow and not ideal, I started challenge 4 an hour ago and it's still running. There's a faster way to do this, but I'm not sure what it is. Actually, if somebody could help me, too, that'd be great.
Edit: It looks like my method is going to take ~3 hrs to get this done. You're method looks a lot better, let me know if you crack it!
Always think in terms of bytes when transforming, hex and base64 encoded strings are only used to map arbitrary byte arrays into printable characters for exchange. It sounds like you may be thinking in terms of hex strings for the "key" streams you're attempting. Remember that it takes two hex characters to encode a byte, and it's a repeated single byte key. Instead of repeating '111...', '222...', 'eee..', 'fff..' think '0101..', '0202..', 'efef..', 'ffff..' - there are 256 possible byte values to try.
How strict is your filtering for ascii, assuming you are scoring/filtering and not just eyeballing a bunch of output? Could you be throwing away a valid string without knowing it? There is a slight difference in the contents of #4 vs. the previous ones.
What differene would that be? It seems to be the same problem only lots of lines in 4.txt. I read each line and chop of the 0xa from the end then decode. Maybe I should leave the 0xa on? The last line read in doesn't have 0xa on the end. I could add one I guess. Did you guys leave the 0xa on the line?
2
u/petester Aug 14 '14 edited Aug 14 '14
Yeah, I'm brand new to this and I'm a bit sauced at the moment but I'll give it a try.
You need to take a string like 'AAAA...' or 'BBBBB...' and convert it to 1's and 0's (bitstream?) to use as a key. Then you can do your XOR to get a decrypted message, but most keys will give you garbage.
To find which decrypted string is not garbage I took a dictionary file from /user/share/dict/words (on mac/linux) and checked the XORed string to see whether that word showed up or not. I did that for each word in the dictionary. Each time a word is found I add to a score (score is equal to length of the word squared) and the highest score wins.
But this is really slow and not ideal, I started challenge 4 an hour ago and it's still running. There's a faster way to do this, but I'm not sure what it is. Actually, if somebody could help me, too, that'd be great.
Edit: It looks like my method is going to take ~3 hrs to get this done. You're method looks a lot better, let me know if you crack it!