I came across this question:

  • Test the security of the following variation of DES-X cryptosystem, which uses 2 keys $k_1$ and $k_2$: $$Enc(m) = DES_{k_1}(m \oplus k_2)$$

(Basically, it uses the 2nd key to xor the text before the DES encryption)

So, I've started researching it and i got confused.

In general, lots of people suggested that XORing the original text or the ciphertext provides extra security only against brute-force attacks.

However, in this very-similar-question, the first answer states that the extra XOR " has almost no advantage compared to DES (even) in term of resistance to brute force".

Both got me confused because, in this illustration of the simple DES, lots of different keys are generated to XOR blocks of the text several times, so I guess the same is happening twice in the variation above (or 3 times in case of DES-X). As I see it, something like this really messes things up.

Is this really so useless even against brute-force attacks? And if so, can you explain it a bit?

  • 1
    $\begingroup$ DESX with 2 keys is usually $\text{DESX}_{(K_1,K_2)}(m)\gets\text{DES}_{K_1}(m\oplus K_2)\oplus K_2$ because that vastly improves resistance against brute-force attack. $\endgroup$
    – fgrieu
    Nov 17, 2018 at 17:51

1 Answer 1


The hint that you have given is simply saying that, if you have more than one (better many) plaintext-ciphertext pairs;

  • First, apply the n-pad attack to recover the real $k_2$ by; $$p_1 \oplus p_2 = m_1 \oplus m_2$$ $$p_1 \oplus p_3 = m_1 \oplus m_3,\ldots$$etc. Once you recover one of the $m_i$'s than $$ p_i = k_2 \oplus m_i$$ is enough to extract the $k_2$

  • Then apply the usual brute-force with $k_2$ is known.

Note: your DES-X is not using key whitening which uses 3 keys, not 2.

  • $\begingroup$ first of all thank you for the answer. if i'm not mistaken, the n-pad attack works if you reuse the key multiple times. why is this happening in my question? $\endgroup$
    – Don S
    Nov 17, 2018 at 17:29
  • $\begingroup$ We assume that we have many pairs with the same keys. Than we applying the n-pad on the input to the DES-X $\endgroup$
    – kelalaka
    Nov 17, 2018 at 17:32
  • $\begingroup$ Ok, let's say you want to use the cryptosystem above, you could just be carefull not to reuse the same key, right? Or is this inevitable at the end? $\endgroup$
    – Don S
    Nov 17, 2018 at 17:39
  • $\begingroup$ Changing the key oftenly is not a good practice. How do you guarantee this for every user of your system? You should better change your system that uses less rules so that users have less rules to break. $\endgroup$
    – kelalaka
    Nov 17, 2018 at 17:43
  • $\begingroup$ oh ok, so testing your cryptosystem must consider using the same key over and over i guess. $\endgroup$
    – Don S
    Nov 17, 2018 at 17:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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