Esempio n. 1
0
        public void MiniAESDecryption(HexMat hexMat)
        {
            //Console.WriteLine("DECRYPTION");
            //Console.WriteLine();

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

            for (int i = 2; i > 0; i--)
            {
                //Console.WriteLine("ROUND " + (i + 1));
                //Console.WriteLine();

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

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

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

                hexMat.InvMiniSubBytes();
                //hexMat.DebugDraw();
                //Console.WriteLine();
            }

            hexMat.AddMiniRoundKey(subKeys[0].hexMat);
            //hexMat.DebugDraw();
            //Console.WriteLine();
        }
Esempio n. 2
0
        public void AESDecryption(HexMat hexMat)
        {
            //Console.WriteLine("DECRYPTION");
            //Console.WriteLine();

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

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

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

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

            for (int i = 8; i >= 0; i--)
            {
                //Console.WriteLine("ROUND " + (10 - i));
                //Console.WriteLine();

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

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

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

                hexMat.InvSubBytes();
                // hexMat.DebugDraw();
                //Console.WriteLine();
            }
        }