6

How can I crack two ciphertexts that have used the same key twice? For example, plaintext1 uses the key "abcdefg", and plaintext2 uses the key "abcdefg".

I know that ciphertext2 ^ ciphertext1 is equal to plaintext1 ^ plaintext2. And the method to crack plaintext1 ^ plaintext2 is the same method to crack a "book cipher" (also sometimes called a "running key cipher", although a running key cipher isn't the same as a book cipher, right?)

I know that I'm supposed to use a dictionary attack, but I'm not sure which dictionary/wordlist I should use, and the algorithm used in cracking this. Can anyone provide me with a link, or some code that shows how to crack it?

I'm new to cryptography, and I just wanted to do this for fun. Can anyone help me out? Thanks.

Steve Vinoski
  • 19,847
  • 3
  • 31
  • 46
Mateen Ulhaq
  • 24,552
  • 19
  • 101
  • 135

1 Answers1

5

The most common attack is to "slide" a common (but not too short) word along and XOR it against successive positions in the combined stream. Where the word was used in one stream, the XOR will (usually) produce readable text for the other stream.

Jerry Coffin
  • 476,176
  • 80
  • 629
  • 1,111
  • 5
    Rather than worrying about pseudocode, I'd advise working it through by hand at least a couple of times; even more than with many other things, cryptanalysis really requires doing some work by hand to honestly understand what you're doing before you can write useful code. – Jerry Coffin Sep 20 '10 at 04:05
  • It's helpful in the selection of the crib word if you know *something* about the plaintext - who it was from or to, what the rough subject might be... – caf Sep 20 '10 at 04:35
  • @caf: You're certainly right that it's helpful, but it's rarely necessary unless they've gone to a *lot* of trouble to avoid common words. – Jerry Coffin Sep 20 '10 at 04:59
  • Thanks, I'll try it sometime this weekend. – Mateen Ulhaq Sep 22 '10 at 01:43