Skip to content
ShiftRows
step 1/5

Reading — step 1 of 5

Read

~1 min readThe Round Operations

ShiftRows

ShiftRows cyclically shifts each row of the state by a different amount:

Before:               After:
| s00 s01 s02 s03 |   | s00 s01 s02 s03 |    (row 0: shift left by 0)
| s10 s11 s12 s13 |   | s11 s12 s13 s10 |    (row 1: shift left by 1)
| s20 s21 s22 s23 |   | s22 s23 s20 s21 |    (row 2: shift left by 2)
| s30 s31 s32 s33 |   | s33 s30 s31 s32 |    (row 3: shift left by 3)

Implementation:

python

Why this matters: combined with MixColumns, ShiftRows ensures that each output bit depends on every input bit after a few rounds. Diffusion.

InvShiftRows shifts in the OPPOSITE direction (or equivalently, by 4-shift).

Discussion

Ask a question, share an insight, or help someone who’s stuck.

Sign in to post a comment or reply.

Loading…