.
AddRoyndKey KeyExpansion 2 (XOR).
AddRoyndKey , KeyExpansion SubWord(RotWord(temp)), Round Constant.
C# 256 (KeyExpansion) :
AKey = new byte[4, 60];
byte ch = 0;
for (int i = 0; i < 4; i++)
{
for (int q = 0; q < 8; q++)
{
AKey[i, q] = key[ch];
ch++;
}
}
for (int i = 8; i < 60; i++)
{
byte[] temp = new byte[4];
for (int q = 0; q < 4; q++)
{
temp[q] = AKey[q, i - 1];
}
if ((i % 8) == 0)
{
temp = SubWord(RotWord(temp), SBox);
for (int q = 0; q < 4; q++)
{
temp[q] ^= RCon[q];
}
}
else if (i % 8 == 4)
{
temp = SubWord(temp,SBox);
}
for (int q=0; q<4; q++)
AKey[q,i] = Convert.ToByte(AKey[q,i - 8] ^ temp[q]);
}
SubBytes MixColumn :
{b1} {b2} :
:
, SubBytes , A 88, b 8- , 4.
4 SubBytes.
( 4 ) :
{a} {b} :
M d. {a} {b} :
MixColumn :
InvMixColumn :
, Rijndael, , (128, 192, 256 ).
.
.
Microsoft Visual Studio 2010. Windows Forms Application C#.
, ELECTRONIC CODEBOOK (ECB), . . . .
|
|