Exemple #1
0
        public void MixColumns_GoesOverMixColumnsStep_Executed()
        {
            byte[][] array =
            {
                new byte[] { 0xd4, 0xe0, 0xb8, 0x1e },
                new byte[] { 0xbf, 0xb4, 0x41, 0x27 },
                new byte[] { 0x5d, 0x52, 0x11, 0x98 },
                new byte[] { 0x30, 0xae, 0xf1, 0xe5 }
            };

            byte[][] expected =
            {
                new byte[] { 0x04, 0xe0, 0x48, 0x28 },
                new byte[] { 0x66, 0xcb, 0xf8, 0x06 },
                new byte[] { 0x81, 0x19, 0xd3, 0x26 },
                new byte[] { 0xe5, 0x9a, 0x7a, 0x4c }
            };

            byte[][] result = AESFunction.MixColumns(array);

            for (int i = 0; i < result.Length; i++)
            {
                for (int j = 0; j < result[i].Length; j++)
                {
                    Assert.AreEqual(expected[j][i], result[j][i]);
                }
            }
        }
Exemple #2
0
 private void Round()
 {
     _stateMatrix = AESFunction.SubBytes(_stateMatrix);
     _stateMatrix = AESFunction.ShiftRows(_stateMatrix);
     _stateMatrix = AESFunction.MixColumns(_stateMatrix);
     byte[][] roundKey = _key.NextSubKey();
     _stateMatrix = AESFunction.AddRoundKey(_stateMatrix, roundKey);
 }