Pseudo-code pour le calcul de la clé étendue, dans le cas
(pour
, il suffit d'enlever le else if ...temp=... final):
KeyExpansion(byte Key[4*Nk] word W[Nb*(Nr+1)])
{
for(i=0; i<Nk; i++)
W[i]=(Key[4*i],Key[4*i+1],Key[4*i+2],Key[4*i+3]);
for(i=Nk; i< Nb*(Nr+1); i++)
{
temp = W[i-1]
if (i%Nk == 0)
temp = S-Box(Rot(temp)) ^ Rcon[i / Nk];
else if (i % Nk == 4)
temp = S-Box(temp);
W[i] = W[i-Nk] ^ temp;
}
}