AES key schedule

From testwiki
Jump to navigation Jump to search

Template:Short description The Advanced Encryption Standard uses a key schedule to expand a short key into a number of separate round keys. The three AES variants have a different number of rounds. Each variant requires a separate 128-bit round key for each round plus one more.[note 1] The key schedule produces the needed round keys from the initial key.

Round constants

Values of Template:Mvar in hexadecimal
Template:Mvar 1 2 3 4 5 6 7 8 9 10
Template:Mvar 01 02 04 08 10 20 40 80 1B 36

The round constant Template:Mvar for round Template:Mvar of the key expansion is the 32-bit word:Template:Refn

rconi=[rci001600160016]

where Template:Mvar is an eight-bit value defined as :

rci={1if i=12rci1if i>1 and rci1<8016(2rci1)11B16if i>1 and rci18016

where is the bitwise XOR operator and constants such as Template:Math and Template:Math are given in hexadecimal. Equivalently:

rci=xi1

where the bits of Template:Mvar are treated as the coefficients of an element of the finite field GF(2)[x]/(x8+x4+x3+x+1), so that e.g. rc10=3616=001101102 represents the polynomial x5+x4+x2+x.

AES uses up to Template:Math for AES-128 (as 11 round keys are needed), up to Template:Math for AES-192, and up to Template:Math for AES-256.[note 2]

The key schedule

AES key schedule for a 128-bit key.

Define:

Also define Template:Math as a one-byte left circular shift:Template:Refn

RotWord([b0b1b2b3])=[b1b2b3b0]

and Template:Math as an application of the AES S-box to each of the four bytes of the word:

SubWord([b0b1b2b3])=[S(b0)S(b1)S(b2)S(b3)]

Then for i=04R1:

Wi={Kiif i<NWiNSubWord(RotWord(Wi1))rconi/Nif iN and i0(modN)WiNSubWord(Wi1)if iNN>6, and i4(modN)WiNWi1otherwise.

Notes

Template:Reflist

References

Template:Reflist


Cite error: <ref> tags exist for a group named "note", but no corresponding <references group="note"/> tag was found