Exemple #1
0
        /* Search a hashed 7 char password in rainbowtable
         * @param [String] searched hash value
         * @return [String] found endWord in dictionary
         */
        public string SearchHashPassword(string hashedPassword)
        {
            string result = string.Empty;

            for (int i = 1999; i >= 0; i--)
            {
                int    l = 1999 - i;
                string wordwordToProcess = string.Empty;
                wordwordToProcess = Reduce(hashedPassword, i);

                //Hash and Reduce hashed Password (Loop through chain of hashed Password)
                for (int j = 0; j < l; j++)
                {
                    wordwordToProcess = EasyMD5.Hash(wordwordToProcess);
                    wordwordToProcess = Reduce(wordwordToProcess, (i + j) + 1);
                }

                // check if calculated word is equals a endWord value in the dictionary
                if (_startEndWords.ContainsValue(wordwordToProcess))
                {
                    Console.WriteLine($"Found match: {wordwordToProcess}");
                    string key = _startEndWords.FirstOrDefault(x => x.Value == wordwordToProcess).Key;
                    result = key;
                    break;
                }
            }

            return(result);
        }
Exemple #2
0
        /*Generates endword for the rainbowtable
         * @param [String] generated start password
         * @param [int] nte element of the chain
         * @return [String] possible endword
         */
        private string GenerateEndWord(string startWord, int level)
        {
            // First hash the string
            string hashedWord = EasyMD5.Hash(startWord);

            // Second apply reducing function
            return(Reduce(hashedWord, level));
        }
Exemple #3
0
        /* Get plain passwort of hashed password
         * @param [String] an endword of the dictionary
         * @param [BigInteger] hash value of search password
         * @return [String] plain password
         */
        public string FindPlainText(string input, BigInteger targetHash)
        {
            string     match             = input;
            string     hashedInput       = EasyMD5.Hash(input);
            BigInteger hashedInputBigInt = BigInteger.Parse(hashedInput, NumberStyles.AllowHexSpecifier);
            int        c = 0;

            //Loop through chain of the found endword from the startword
            //The last reduced word before targetHash is equals to a chain hash element is the plain password
            while (c < _chainLength && !hashedInputBigInt.Equals(targetHash))
            {
                match             = Reduce(hashedInput, c++);
                hashedInput       = EasyMD5.Hash(match);
                hashedInputBigInt = BigInteger.Parse(hashedInput, NumberStyles.AllowHexSpecifier);
            }

            return(match);
        }