# How does AES-256 works if AES is only a 128-bit block cipher?

I'm currently studying AES encryption and I'm quite confused on how do we use a 256-bit key in AES?

Becuase in my understanding, AES no matter what the key size is, it still operates and encrypt a 128-bit block of message only in the whole cycle/rounds until it reaches the end.

well for AES-128 we use a 128-bit key that is total of 16 byte char, and that can be represented by a 4x4 matrix, and most AES operations and steps works on 4x4 matrix right?

Then how do we use a 256 bit key?, that is a 32 byte char and that is not even a perfect square right?

Will that 256-bit key result into the same size of 128-bit key version of AES when expanded by key expansion? and just use 16 bytes each when encrypting to match the 4x4 state array?

• Nov 9, 2021 at 10:07

Even for AES128 we don't use the key directly. Each round gets its own key in the process called key expansion. Those round keys are used to transmute a matrix. The original key is never applied directly.

AES256 adds more rounds. Each round stays the same, only the key derivation for them changes slightly. This allows for less dependant round keys, which hopefully adds to the cipher strength. However, there is some deficiency in the key expansion algorithm which makes the 192 and 256-bit variants more susceptible to related key attacks.

• Yes. The process of turning the 256-bit key of AES-256 into fifteen 128-bit round (sub)keys is the AES key expansion, also known as AES key schedule.
– fgrieu
Nov 9, 2021 at 6:54
• @fgrieu thanks now I think I got the idea Nov 9, 2021 at 12:17
• Minor nitpick: the first round key of AES-128 is, in fact, the original key, so it is "applied directly". But the round keys after that are computed with key expansion. (For AES-192, the first round key is the first 128 bits of the key, and the second round key's first 64 bits are the remainder. Similarly, the first two round keys are halves of the original key in AES-256.) Nov 9, 2021 at 19:40

If you're wondering why a 256-bit key offers any greater security, you need to realize that a 128-bit block cipher is essentially a way of mapping $$2^{128}$$ input values to $$2^{128}$$ output values. That means the set of all possible 128-bit block ciphers has a size of $$2^{128}!$$, which is about $$10^{10^{40}}$$.

A 128-bit key allows you to choose one of $$2^{128}$$ possible mappings. Although this is a huge number, it's a vanishingly small fraction of the set of all ciphers. The same could be said for any practical key size, but with a 256-bit key, you get to choose from a far larger set of possible input-output mappings, making the encryption that much harder to crack.

• Key size doesn't mean it is harder to crack! The design makes it harder to crack. It is necessary but not sufficient! Nov 9, 2021 at 13:41
• This consideration is completely true only for truly random permutations, while AES is a pseudorandom permutatuion. Nov 9, 2021 at 14:01