The SubBytes Function Substitutes the values in the state matrix with values in an S-box.
| 355 | // The SubBytes Function Substitutes the values in the |
| 356 | // state matrix with values in an S-box. |
| 357 | static void SubBytes(state_t* state) |
| 358 | { |
| 359 | uint8_t i, j; |
| 360 | for (i = 0; i < 4; ++i) |
| 361 | { |
| 362 | for (j = 0; j < 4; ++j) |
| 363 | { |
| 364 | (*state)[j][i] = getSBoxValue((*state)[j][i]); |
| 365 | } |
| 366 | } |
| 367 | } |
| 368 | |
| 369 | // The ShiftRows() function shifts the rows in the state to the left. |
| 370 | // Each row is shifted with different offset. |