# Does the MixColumns step come before or after AddRoundKey in AES decryption?

I found these images depicting the AES decryption process:

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?

-
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

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

-

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

-
InvMixColumn(x+RoundKey) = InvMixColumn(x) + InvMixColumn(RoundKey)