7. ShiftRows

round

Our second transformation, ShiftRows, is a pretty simple one! It takes a state, look at its rows and rotate them. The first row doesn't get touched, the second one gets rotated by one position on the left, the third by two positions and the fourth by three positions.

0 1 2 3    0 1 2 3    
4 5 6 7 -> 5 6 7 4
8 9 a b    a b 8 9
c d e f    f c d e

Go ahead and create a ShiftRows() function that takes a state and returns a new state after the ShiftRows transformation.

Are you done yet?

Next