Пример #1
0
        public void MiniAESEncryption(HexMat hexMat)
        {
            //Console.WriteLine("ENCRYPTION");
            //Console.WriteLine();
            //hexMat.DebugDraw();
            //Console.WriteLine();

            hexMat.AddMiniRoundKey(subKeys[0].hexMat);
            //hexMat.DebugDraw();
            //Console.WriteLine();

            for (int i = 1; i < 3; i++)
            {
                //Console.WriteLine("ROUND " + (i + 1));
                //Console.WriteLine();

                hexMat.MiniSubBytes();
                //hexMat.DebugDraw();
                //Console.WriteLine();

                hexMat.ShiftRows();
                // hexMat.DebugDraw();
                //Console.WriteLine();

                hexMat.MiniMixColumns();
                //hexMat.DebugDraw();
                //Console.WriteLine();

                hexMat.AddMiniRoundKey(subKeys[i].hexMat);
                //hexMat.DebugDraw();
                //Console.WriteLine();
            }
        }
Пример #2
0
        public void AESEncryption(HexMat hexMat)
        {
            //Console.WriteLine("ENCRYPTION");
            //Console.WriteLine();

            for (int i = 0; i < 9; i++)
            {
                //Console.WriteLine("ROUND " + (i + 1));
                //Console.WriteLine();

                hexMat.SubBytes();
                //hexMat.DebugDraw();
                //Console.WriteLine();

                hexMat.ShiftRows();
                //hexMat.DebugDraw();
                //Console.WriteLine();

                hexMat.MixColumns();
                //hexMat.DebugDraw();
                //Console.WriteLine();

                hexMat.AddRoundKey(subKeys[i].hexMat);
                //hexMat.DebugDraw();
                //Console.WriteLine();
            }

            //Console.WriteLine("FINAL ROUND");
            //Console.WriteLine();

            hexMat.SubBytes();
            //hexMat.DebugDraw();
            //Console.WriteLine();

            hexMat.ShiftRows();
            //hexMat.DebugDraw();
            //Console.WriteLine();

            hexMat.AddRoundKey(subKeys[9].hexMat);
            //hexMat.DebugDraw();
            //Console.WriteLine();
        }