In DES, I'm given the following exercise.

enter image description here - How can I find out which part of the plaintext each ciphertext message corresponds to, and which mode they were each encrypted with?

  • 1
    $\begingroup$ Welcome to Cryptography. Nice homework for you. Have you ever looked at the block cipher modes of operation page on Wikipedia? Hint : The plaintext message size can you give information about either padding required or not, CTR doesn't require. $\endgroup$
    – kelalaka
    Mar 16, 2020 at 22:20
  • $\begingroup$ @kelalaka Sorry about that, allow me to attempt to clarify a bit. It is technically 2 plaintext messages according to the assignment, with 5 modes used in each to total up to 10 ciphertext messages, as far as I understand it. It's very wordy and hard to understand, so here's a screenshot if my explanation isn't correct gyazo.com/f128a0ecb53a142b88f23973089131f2. There's 10 messages of ciphertext, I just didn't screenshot all of them. $\endgroup$ Mar 16, 2020 at 22:29
  • $\begingroup$ @kelalaka I actually didn't even notice that... it must correspond to the same plaintext characters as the other one? Maybe its parts of the two instances of 'Hello there!'? $\endgroup$ Mar 16, 2020 at 22:41
  • $\begingroup$ When you say message 2 has 17, making it unusual, are you implying that as a hint or something that you yourself don't understand? $\endgroup$ Mar 16, 2020 at 22:50
  • $\begingroup$ @kelalaka I think the second message is the complete line. MajorPain, which modes are expected? There are more than 5 modes. $\endgroup$
    – Maarten Bodewes
    Mar 17, 2020 at 19:26

1 Answer 1


Let's assume that we're talking about the following classic modes for block ciphers (although there are certainly more): ECB, CBC, CFB, OFB and CTR.

First of all the second message is way too long to fit into the ciphertext, so we can safely discard that possibility.

Then we can look at the size of the plaintext and ciphertext. The plaintext message is 14 character, which are generally encoded to 14 bytes. The size of the three ciphertext are 14, 16 and 14 bytes.

Now ECB and CBC are generally using padding, so that the padded plaintext and the ciphertext are Y times the block size. The other modes are streaming modes so they don't require padding, and the size of the messages are identical to the plaintext size.

So with that in mind, ciphertext one is using streaming (CFB, OFB or CTR), ciphertext two is using ECB or CBC and ciphertext 3 is using streaming again.

Can we find out more? Sure, message 1 and 3 are clearly starting with the same ciphertext. Now for CTR only the first half of the IV was used, so it is less likely that will correspond with either of the two ciphertext. That would only be the case if the second half of the IV was set to all zeros (the initial counter value is identical to the IV) for the other modes.

That leaves CFB and OFB, and if we look at those schemes we see that the calculation of the first ciphertext is exactly identical to each other. Only after that there are differences, because one uses ciphertext feedback, while the other uses output feedback.

Can we say much more? I don't think so. We lack any information to distinguish ECB from CBC or CFB from OFB (other than knowing that if one ciphertext uses one, the other one must have been generated using the other).

If there are ways of using the blocks of one cipher to determine the precise mode of another then I don't see it. OFB and CFB start with encrypting the IV, and CTR and CBC don't do that.

Once the calculations end up with a different input to the block cipher and are permuted, we cannot learn anything from them unless we know the permutation - i.e. the key. We can just tell the blocks apart.

  • $\begingroup$ Anything missing from my answer, Mr MajorPain? $\endgroup$
    – Maarten Bodewes
    Apr 1, 2020 at 16:03

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.