public void MixColumnsIndirect()
        {
            byte[] input = { 0x5f, 0x72, 0x64, 0x15, 0x57, 0xf5, 0xbc, 0x92, 0xf7, 0xbe, 0x3b, 0x29, 0x1d, 0xb9, 0xf9, 0x1a };
            byte[] output = { 0x63, 0x53, 0xe0, 0x8c, 0x09, 0x60, 0xe1, 0x04, 0xcd, 0x70, 0xb7, 0x51, 0xba, 0xca, 0xd0, 0xe7 };

            AesTransformation.InvMixColumns(input);
            Assert.Equal(output, input);
        }
 public void ShiftRowsInDirect()
 {
     byte[] input =  { 0x63, 0x53, 0xe0, 0x8c, 0x09, 0x60, 0xe1, 0x04, 0xcd, 0x70, 0xb7, 0x51, 0xba, 0xca, 0xd0, 0xe7 };
     byte[] output = { 0x63, 0xca, 0xb7, 0x04, 0x09, 0x53, 0xd0, 0x51, 0xcd, 0x60, 0xe0, 0xe7, 0xba, 0x70, 0xe1, 0x8c };
     
     AesTransformation.InvShiftRows(input);
     
     Assert.Equal(output, input);
 }
        public void SubBytesIndirect()
        {
            byte[] input = { 0x63, 0xca, 0xb7, 0x04, 0x09, 0x53, 0xd0, 0x51, 0xcd, 0x60, 0xe0, 0xe7, 0xba, 0x70, 0xe1, 0x8c };
            byte[] output = { 0x00, 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80, 0x90, 0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0 };
            
            AesTransformation.InvSubBytes(input);

            Assert.Equal(output, input);
        }
        public void KeyExpansionDirect()
        {
            byte[] input = { 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c };
            uint[] expected = {
                BitConverter.ToUInt32(new byte[]{ 0xa0, 0xfa, 0xfe, 0x17 }, 0),
                BitConverter.ToUInt32(new byte[]{ 0x88, 0x54, 0x2c, 0xb1 }, 0),
                BitConverter.ToUInt32(new byte[]{ 0x23, 0xa3, 0x39, 0x39 }, 0),
                BitConverter.ToUInt32(new byte[]{ 0x2a, 0x6c, 0x76, 0x05 }, 0)
            };

            uint[] actual = AesTransformation.KeyExpansion(input).Skip(4).Take(4).ToArray();
            Assert.Equal(expected, actual);
        }
        public void SubBytesAndInvSubSytesThrowsOnInvalidSizedByteArray()
        {
            byte[] input = { 0x63, 0xca, 0xb7 };
            Assert.Throws<ArgumentException>(() =>
            {
                AesTransformation.SubBytes(input);
            });

            Assert.Throws<ArgumentException>(() =>
            {
                AesTransformation.InvSubBytes(input);
            });
        }