| Pseudocode for Cipher () Algorithm | |
| 1 | procedure Cipher (in, w, Nr) |
| 2 | state ← in |
| 3 | state ← AddRoundKey(state,w[0..3]) |
| 4 | for round from 1 to Nr −1 do |
| 5 | state ← SubBytes(state) |
| 6 | state ← ShiftRows(state) |
| 7 | state ← MixColumns(state) |
| 8 | state ← AddRoundKey(state,w[4 ∗ round..4 ∗ round + 3]) |
| 9 | end for |
| 10 | state ← SubBytes(state) |
| 11 | state ← ShiftRows(state) |
| 12 | state ← AddRoundKey(state,w[4 ∗Nr..4 ∗Nr + 3]) |
| 13 | return state |
| 14 | end procedure |