Esempio n. 1
0
        public void HackProcAes1(string fileName, string chiper, string output)
        {
            AESEncrypte       aesDyc = new AESEncrypte();
            List <stateBlock> _temp  = createDataState(createByteArr(fileName));

            List <stateBlock> testChiper = createDataState(createByteArr(chiper));

            Stopwatch stopwatch = new Stopwatch();

            _temp = aesDyc.mixColumns(aesDyc.shiftRow(aesDyc.subByte(_temp)));

            stopwatch.Start();

            byte[] block = new byte[16];

            List <stateBlock> TheKey = new List <stateBlock>();

            for (int countState = 0; countState < 1; countState++)
            {
                stateBlock s = new stateBlock(block);

                for (int i = 0; i < 4; i++)
                {
                    for (int j = 0; j < 4; j++)
                    {
                        s._data[i, j] = (byte)(testChiper[countState]._data[i, j] ^ _temp[countState]._data[i, j]);
                    }
                }

                TheKey.Add(s);
            }


            stopwatch.Stop();
            Console.WriteLine("Total Time to Hacking: " + stopwatch.Elapsed.ToString());

            byte[] curr = BuildKey(TheKey);

            File.WriteAllBytes(output, curr);
        }
Esempio n. 2
0
 public AES()
 {
     de = new AESDecrypte();
     en = new AESEncrypte();
 }