Exemplo 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();
        }
Exemplo n.º 2
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();
            }
        }