2
$\begingroup$

So, I uploaded a text file in Cryptool and encrypted it with DES-ECB with the key FF FF FF FF FF FF FF FF. I encrypted the cipher text again, with DES-CBC using the same key. Then, I encrypted the obtained text with DES-CBC again.

The first 8 characters match the encrypted text of ECB. The rest of it is different. I would like to know why those 8 characters are similar and why the rest of it are not? It would be very helpful if anyone could explain this to me.

Screenshot of CrypTool in action, showing the described cyphertexts.

$\endgroup$
3
  • $\begingroup$ Experts can someone please assist me in understanding this,unable to get into chat due to low reputation. Thanks in advance $\endgroup$
    – Swathi
    Commented Jul 4, 2014 at 6:39
  • 1
    $\begingroup$ What IV did you use in CBC mode? $\endgroup$ Commented Jul 4, 2014 at 7:09
  • $\begingroup$ @HennoBrandsma, Sorry I am a newbie to cryptool.How do we look for initialization vector in cryptool? $\endgroup$
    – Swathi
    Commented Jul 4, 2014 at 13:47

1 Answer 1

3
$\begingroup$

There are a couple of things going on:

  • First of all, the DES key FF FF FF FF FF FF FF FF happens to be a "DES weak key"; by that, we mean that if you send a block through the cipher twice, it'll end up with the original value; that is:

    $$X = DES_{weak}( DES_{weak} ( X ))$$

  • You are obviously encrypting in CBC mode with a zero IV.

So, let us look at what happens to the first block during your encryption. He's call the initial value of that plaintext block $A$ (which is 44 6F 75 62 6C 65 20 65 in your example)

  • First you encrypt the text in ECB mode. For the first block, this just sends it through DES, resulting in a ciphertext block we're call $B$ (which is A3 77 A8 0A AD 2B EA 6E in your example:

$$B = DES_{weak}(A)$$

  • Then, you encrypt that in CBC mode (with a zero IV). For the first block, this exclusive or's the block with the IV, and sends it through DES. Because we are using a weak key, this results in the original $A$ block, as:

$$DES_{weak}(IV \oplus B) = DES_{weak}(B) = DES_{weak}(DES_{weak}(A)) = A$$

  • Lastly, you encrypt the text again in ECB mode. For the first block, this just redoes what we did in the first pass (because the first block is the exact same value it was):

$$B = DES_{weak}(A)$$

Now, this doesn't happen with the second block; that's because of the CBC mode in the second pass. CBC mode exclusive or's in the value of the first block, and since that is not zero, the second equation does not hold.

$\endgroup$
1
  • $\begingroup$ Thank you for your valuable feedback. It was really helpful. $\endgroup$
    – Swathi
    Commented Jul 4, 2014 at 16:29

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.