MixColumns function mixes the columns of the state matrix. The method used to multiply may be difficult to understand for the inexperienced. Please use the references to gain more information.
| 454 | // The method used to multiply may be difficult to understand for the inexperienced. |
| 455 | // Please use the references to gain more information. |
| 456 | static void InvMixColumns(state_t* state) |
| 457 | { |
| 458 | int i; |
| 459 | uint8_t a, b, c, d; |
| 460 | for (i = 0; i < 4; ++i) |
| 461 | { |
| 462 | a = (*state)[i][0]; |
| 463 | b = (*state)[i][1]; |
| 464 | c = (*state)[i][2]; |
| 465 | d = (*state)[i][3]; |
| 466 | |
| 467 | (*state)[i][0] = Multiply(a, 0x0e) ^ Multiply(b, 0x0b) ^ Multiply(c, 0x0d) ^ Multiply(d, 0x09); |
| 468 | (*state)[i][1] = Multiply(a, 0x09) ^ Multiply(b, 0x0e) ^ Multiply(c, 0x0b) ^ Multiply(d, 0x0d); |
| 469 | (*state)[i][2] = Multiply(a, 0x0d) ^ Multiply(b, 0x09) ^ Multiply(c, 0x0e) ^ Multiply(d, 0x0b); |
| 470 | (*state)[i][3] = Multiply(a, 0x0b) ^ Multiply(b, 0x0d) ^ Multiply(c, 0x09) ^ Multiply(d, 0x0e); |
| 471 | } |
| 472 | } |
| 473 | |
| 474 | |
| 475 | // The SubBytes Function Substitutes the values in the |