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

I found these images depicting the AES decryption process:

enter image description here enter image description here

In the first image, the MixColumns step comes before the AddRoundKey step, while in the second image, the AddRoundKey will come before the MixColumns.

Which order is the correct one?

share|improve this question
Have a look at my answer to »Why is MixColumns omitted from the last round of AES?«. Both are correct, but with a different expanded key. – Paŭlo Ebermann May 25 '12 at 17:54
what do you mean by different expanded key? – goldroger May 25 '12 at 18:02
Did you actually read the linked answer? You'll see that the third code block uses InvMixColumns(ExpandedKey[i]) instead of ExpandedKey[i] (in the last block, this is shown as EqExpandedKey[i]). – Paŭlo Ebermann May 25 '12 at 18:06
@JohnPaulParreño: I'd correct my answer (I originally talked about the ShiftRows and SubBytes operation), however, I can't really say it better than that Paŭlo said in his answer that he linked to; look at that. – poncho May 25 '12 at 23:18
possible duplicate of Why is MixColumns omitted from the last round of AES? – mikeazo Jun 4 '12 at 19:21

InvMixColumns is a linear operation. And because of that it follows:

InvMixColumn(x+RoundKey) = InvMixColumn(x) + InvMixColumn(RoundKey)
                                         "new" round key for decryption

So, the structure on the right is compatible with the structure on the left as long as you use different round keys. The idea behind this is to make the decryption structure look like encryption structure with just a couple of "Inv"s in there. But I'm actually not sure what the benefit of this is. For a block cipher like Anubis (which is similar to AES) it makes much more sense because each operation is an involution. The only difference between encryption and decryption for Anubis are the round keys. So, you can reuse the encryption code for decryption which is a nice property.

share|improve this answer

Not sure if this is answered fully, but if you check wikipedia, you'll see that AddRoundKey occurs 3 times in total with 1 time before and 1 time after the MixColumns operation.

However, if you are just considering the middle rounds then the MixColumns comes before

share|improve this answer

After the AddRoundKey step, except for the last round, where it does not happen

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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