static void printState (byteArray &bytes, std::string name);
AES::AES (const byteArray& key)
- : Nb(4) // This is constant in AES
- , Nk(key.size() / 4) // This can be either 4, 6, or 8 (128, 192, or 256 bit)
+ : Nk(key.size() / 4) // This can be either 4, 6, or 8 (128, 192, or 256 bit)
, Nr(Nk + Nb + 2)
, keySchedule(Nb * (Nr+1), 0x00000000)
{
byteArray wBytes = word2bytes (w[i]);
for (j=0; j<Nb; ++j)
- {
- //std::printf ("state.at(%d) ^= wBytes.at(%d) -- %.2x ^ %.2x = %.2x\n", i*Nb+j, j, state.at (i*Nb+j), wBytes.at(j), state.at(i*Nb+j) ^ wBytes.at(j));
state.at(j*Nb+i) ^= wBytes.at(j);
- }
}
}