Rijndael: The Advanced Encryption Standard
by Joan Daemen and Vincent Rijmen



Example 1: 
(a)
Round(State,RoundKey) {
ByteSub(State);
ShiftRow(State);
MixColumn(State);
AddRoundKey(State,RoundKey);
}

(b)
FinalRound(State,RoundKey) {
ByteSub(State);
ShiftRow(State);
AddRoundKey(State,RoundKey);
}


Example 2:

Rijndael(State,CipherKey) {
KeyExpansion(CipherKey,ExpandedKey);
AddRoundKey(State,ExpandedKey);
for(i=1; i < Nr; i++) Round(State,ExpandedKey + Nbi);
FinalRound(State,ExpandedKey+NbNr);
}


Listing One

KeyExpansion(CipherKey,W) {
for(i=0; i < Nk; i++)W[i]=CipherKey[i];
for(j= Nk; j < Nb(Nr+1); j+= Nk) {
   W[j]=W[j- Nk] ( SubByte(Rot(W[j-1])) ( Rcon[j= Nk]; 
      if (Nk ( 6){ 
         for(i=1; i < Nk; i++)
            W[i+j] = W[i+j- Nk] ( W[i+j-1]; 
         } 
      else {
         for(i=1; i < 4; i++) 
              W[i+j] = W[i+j- Nk] ( W[i+j-1]; 
         W[j+4] = W[j+4- Nk] ( SubByte(W[j+3]); 
         for(i=5; i < Nk; i++) 
               W[i+j] = W[i+j- Nk] ( W[i+j-1]; 
         }
     }
}





1

