I am implementing AES 256-bit Algorithm from the Theory given in the book, "Cryptography and Network Security" by Behrouz A. Forouzan.
The Algorithm described in the Book in relation to
Key Expansion, defines
AddRoundKey like this:
From the given 32-Bytes Cipher Key, I am supposed to generate
4 * (Nr + 1) words.
Nr being the number of rounds which is equal to 14 in 256bit AES and each
word is equal to
So, according to the equation,
4 * (Nr + 1), We have total
4*(15) = 60 Words to be generated. Those 60 words are
w,w,w,w,…,w. The first 8 words would be generated directly from the given 32bytes cipher key:
w = First 4Bytes of Cipher key w = Next 4bytes of Cipher Key w = Next 4 bytes of Cipher. … w = last 4-bytes of Cipher key.
The remaining words
(w to w) would be generated according to the following Formula:
i mod 8 is not equals to
i is the word number from 8 to 59
W[i] = W[i-1] ^ W[i-8] ; ^ = XOR Operation
W[i] = t + w[i-8]
t equals to,
SubWord(RotateWord(W[i-1])) ^ RCon(i/4). If
i mod 4 = 0, but
imod8 is not equals to
W[i] would be
W[i] = SubWord(W[i-1]) + W[i-8] After the above algorithm is implemented, It is quite easy to calculate
But Wikipedia's "Rijndael key schedule" article has a totally different method of calculation which I am unable to understand. They use different techniques, and there are few Constants like
b, which weren't mentioned in the book, nor are they mentioned anywhere else. Yet, Wikipedia's Algorithm is using them.
I would like to know the difference between the AES256 algorithm presented in the book and the AES256 article on Wikipedia. Can you explain and/or help me understand why there are two different approaches for Key Expansion in relation to the AES-256 algorithm?