Beispiel #1
0
 private void ReverseFinalRound()
 {
     byte[][] roundKey = _key.PreviousSubKey();
     _stateMatrix = AESFunction.AddRoundKey(_stateMatrix, roundKey);
     _stateMatrix = AESFunction.ReverseShiftRows(_stateMatrix);
     _stateMatrix = AESFunction.ReverseSubBytes(_stateMatrix);
 }
Beispiel #2
0
        public void ReverseSubButes_GoesOverSubBytesStep_Replaced()
        {
            byte[][] array =
            {
                new byte[] { 0xd4, 0xe0, 0xb8, 0x1e },
                new byte[] { 0x27, 0xbf, 0xb4, 0x41 },
                new byte[] { 0x11, 0x98, 0x5d, 0x52 },
                new byte[] { 0xae, 0xf1, 0xe5, 0x30 }
            };

            byte[][] expected =
            {
                new byte[] { 0x19, 0xa0, 0x9a, 0xe9 },
                new byte[] { 0x3d, 0xf4, 0xc6, 0xf8 },
                new byte[] { 0xe3, 0xe2, 0x8d, 0x48 },
                new byte[] { 0xbe, 0x2b, 0x2a, 0x08 }
            };

            byte[][] result = AESFunction.ReverseSubBytes(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]);
                }
            }
        }