Given two 56-bit keys, $k_1$ and $k_2$, why does $E_{k_1}(E_{k_2}(M))$ only give 57 bits of security?

So basically I'm unsure why it only gives 57 bits of security; I understand that one key will provide 56 bits. Only thing I can think of is that when adding another 56 bit it will cycle through all the bits and realize they are the same so it just adds 1 extra bit, for the second keyblock instead of another 56 bits?

If I'm wrong, could someone please explain it simply and step-by-step?

  • $\begingroup$ This basic question is NOT a duplicate of these questions. In fact I do not find it either asked or answered anywhere on CSE. We have a closely related but more complex question, with good answers: Attacking 2DES efficiently. $\endgroup$ – fgrieu Apr 19 '15 at 9:27
  • 1
    $\begingroup$ I looked closer, and indeed we have a close match for that question, though asked in more precise and quantitative terms: Meet-in-the-middle with checking complexity, with a good answer. $\endgroup$ – fgrieu Apr 19 '15 at 9:57
  • $\begingroup$ I ask in meta if we should have closed this question, or should reopen it so as not to loose its simple and useful answer. $\endgroup$ – fgrieu Apr 19 '15 at 14:41

Decrypt the ciphertext with every possible key and store the result: $2^{56}$ decryptions. Now encrypt the (known) plaintext of the ciphertext with every possible key: $2^{56}$ encryptions. Now you have to check every entry, which is in both lists and try it with another plaintext-ciphertext pair. If you can successfully decrypt that, you are very likely to have found the correct key. All in all $2^{56} + 2^{56} = 2^{57}$ DES operations (encryptions and decryptions), much less than $2^{112}$. You need some work to search inside the list and check every possible key, but for DES this is not really much work.

All this is called Meet-in-the-middle attack.

  • 3
    $\begingroup$ Note that an actual attacker wouldn't create a table with $2^{56}$. They'd use distinguished points/cycle finding to reduce the memory use. $\endgroup$ – CodesInChaos Apr 18 '15 at 18:49
  • $\begingroup$ @CodesInChaos: I would be surprised that distinguished points/cycle finding can work with known plaintext (which seems to be the context of the question, since it is said that DES has 56-bit security, when it has only 55-bit security under chosen-plaintext attack due to DES's complementation property, with $\operatorname{DES}_{k_1}(\operatorname{DES}_{k_2}(M))$ only about 56-bit security, not 57-bit). $\;$ More generally, I'm not sure that I understand what you are thinking about. $\endgroup$ – fgrieu Apr 19 '15 at 9:16
  • 1
    $\begingroup$ @fgrieu I guess we could build the table with only one block of plaintext-ciphertext, and for each of the $2^{48}$ found matches check the second block. This would have work of $2^{57} + 2^{49}$, which I would still consider as 57-bit security. $\endgroup$ – Paŭlo Ebermann Apr 19 '15 at 9:44
  • 1
    $\begingroup$ @fgrieu: We can just fix the answer and everyone is / should be happy. It's not like the answer was fundamentally wrong. Please take a look now and mention other problems, if you find some. $\endgroup$ – Nova Apr 19 '15 at 11:39
  • $\begingroup$ @Nova: some user, like Paŭlo Ebermann, consider fine that others edit their post, and explicitly give license to that effect in their profile. In that case (only) I feel comfortable to edit (rather than constructively criticize) their answer when I see something wrong but fixable. $\endgroup$ – fgrieu Apr 19 '15 at 14:32

Not the answer you're looking for? Browse other questions tagged or ask your own question.