Пример #1
0
        public static void CreateNewKey(int currentCharPosition, char[] keyChars, int keyLength, int indexOfLastChar, string pswd)
        {
            var nextCharPosition = currentCharPosition + 1;

            for (int i = 0; i < peremennyi.charactersToTestLength; i++)
            {
                keyChars[currentCharPosition] = peremennyi.charactersToTest[i];

                if (currentCharPosition < indexOfLastChar)
                {
                    KeySolution.CreateNewKey(nextCharPosition, keyChars, keyLength, indexOfLastChar, pswd);
                }

                else
                {
                    peremennyi.computedKeys++;
                    if (Get_hash.GetHashString(new String(keyChars)) == pswd)
                    {
                        peremennyi.count_pass += 1;
                        Console.WriteLine("Поток {1}: Паролей подобрано - {0}", peremennyi.count_pass, Thread.CurrentThread.ManagedThreadId);
                        Console.WriteLine("Поток {1}: Прошло времени: {0} сек", DateTime.Now.Subtract(peremennyi.timeStarted).TotalSeconds, Thread.CurrentThread.ManagedThreadId);
                        peremennyi.result = new String(keyChars);
                        Console.WriteLine("Поток {1}: Полученный пароль: {0}", peremennyi.result, Thread.CurrentThread.ManagedThreadId);
                        Console.WriteLine("Поток {1}: Вычислено паролей: {0}", peremennyi.computedKeys, Thread.CurrentThread.ManagedThreadId);
                        return;
                    }
                }
            }
        }
Пример #2
0
        public static void StartProgram(object pasnumber)
        {
            Console.WriteLine("Поток {1}: Время начала подбора - {0}", peremennyi.timeStarted.ToString(), Thread.CurrentThread.ManagedThreadId);
            var estimatedPasswordLength = 5;

            KeySolution.StartBruteForce(estimatedPasswordLength, pasnumber.ToString());
        }
Пример #3
0
        public static void StartBruteForce(int keyLength, string pswd)
        {
            var keyChars        = CreateCharArray.CharArray(keyLength, peremennyi.charactersToTest[0]);
            var indexOfLastChar = keyLength - 1;

            Console.WriteLine("Хэш для потока {1}: {0}", pswd, Thread.CurrentThread.ManagedThreadId);
            KeySolution.CreateNewKey(0, keyChars, keyLength, indexOfLastChar, pswd);
        }