# AES: Why ShiftRows() before MixColumns()? [duplicate]

In above picture you can see a AES state array over 2 rounds through the S- and P-Boxes of AES. It's taken from here and intends to show how 2 rounds of transformation are necessary to achieve full diffusion after only the first byte has changed.

If one would MixColumns() before MixRows() diffusion, one would reach diffusion one step earlier. So I wonder what is the reason to ShiftRows() before MixColumns()?

• If one would MixColumns() before MixRows() diffusion, one would reach diffusion one step earlier, could you please explain it more? – hardyrama Apr 11 '19 at 17:45
• @hardyrama Let's ignore the SubBytes() Operation since it doesn't affect Diffusion. If we MixColumns() in the fist step, the changed byte diffuses into the whole first column. After ShiftRows() is applied, theres one changed byte in every column. After another MixColumn() operation every byte in the state array has changed, requiring only 3 steps until diffusion was reached. – Andy Ef Apr 11 '19 at 18:24
• Take a look at the comments of this answer – Faulst Apr 11 '19 at 19:53