Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

marked as duplicate by Nova, Gilles, D.W., Reid, DrLecter Apr 19 '15 at 10:15

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

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. – fgrieu Apr 19 '15 at 9:27
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. – fgrieu Apr 19 '15 at 9:57
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. – fgrieu Apr 19 '15 at 14:41
up vote 13 down vote accepted

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.

share|improve this answer
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. – CodesInChaos Apr 18 '15 at 18:49
@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. – fgrieu Apr 19 '15 at 9:16
@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. – Paŭlo Ebermann Apr 19 '15 at 9:44
@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. – Nova Apr 19 '15 at 11:39
@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. – fgrieu Apr 19 '15 at 14:32

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