pdf文档中给了伪代码 解释一下变量 Nb 列数 Number of columns (32-bit words) comprising the State. For this standard, Nb = 4. (Also see Sec. 6.3.) Nk 密钥数 Number of 32-bit words comprising the Cipher Key. For this standard, Nk = 4, 6, or 8. (Also see Sec. 6.3.) Nr 加密轮数 Number of rounds, which is a function of Nk and Nb (which is fixed). For this standard, Nr = 10, 12, or 14. (Also see Sec. 6.3.)
KeyExpansion(byte key[4*Nk], word w[Nb*(Nr+1)], Nk) begin
word temp i = 0
while (i < Nk) w = word(key[4*i], key[4*i+1], key[4*i+2], key[4*i+3]) i = i+1 end while
i = Nk
while (i < Nb * (Nr+1)] temp = w[i-1] if (i mod Nk = 0) temp = SubWord(RotWord(temp)) xor Rcon[i/Nk] else if (Nk > 6 and i mod Nk = 4) temp = SubWord(temp) end if w = w[i-Nk] xor temp i = i + 1 end while
文章评论(0条评论)
登录后参与讨论