Can anyone explain to me (or send a link to somewhere) how round keys are added in AES-256? I understand that the round keys is added to the state matrix for each round and how XOR works. But since the state matrix is always 128 bits, how do you add an 256 bit round key?

I might be confused on a higher level right now...


1 Answer 1


how do you add an 256 bit round key?

Actually, each round key is 128 bits, and so XORing them into the state matrix is easy.

What the AES key expansion process does is take the 256 bit AES key, and generate 15 round keys (one more than the number of AES rounds). Now, for AES256, the first two round keys are, in fact, 256 bits taken directly from the AES key. After that, it computed the next round key based on a simple function of the previous two round keys (plus a per round constant).

  • 3
    $\begingroup$ But with AES256 the key size is 256 bits and that gives a key size of 256 bit or a 4x8 matrix, right? So you just split it into two 4x4 matrixes and call them the first two round keys? $\endgroup$
    – Firez4r
    Dec 15, 2015 at 22:44
  • 1
    $\begingroup$ @Firez4r: yeah, that's one way of looking at it. $\endgroup$
    – poncho
    Dec 15, 2015 at 22:51
  • $\begingroup$ A doubt.**Can you please clarify if i am wrong?** In AES 256, key matrix is of 4*8 i.e.two matrix of 4*4. Are we performing XOR between these 2 matrixes to make 4*4 single key block matrix as an input to plain text to perform XOR again with the state matrix of 4*4 block $\endgroup$
    – user34226
    May 13, 2016 at 14:22
  • $\begingroup$ @HimanshuPant: again, we use the 256 key bits to generate 15 128-bit subkeys; the first 2 subkeys are taken directly from the original key bits; after that, we generate another subkey, but it isn't as simple as xor'ing the two matricies together. Instead, the process involves 32 bit rotates, sbox lookups, an occasional round constant, and yes, xor's. You might want to study the AES documentation if you're interested in the details... $\endgroup$
    – poncho
    May 13, 2016 at 18:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.