public void StartWordsComboSearch(string[] _guessWords, string _wordSeperator = "")
        {
            guessWords = _guessWords; wordSeperator = _wordSeperator;

            StringBuilder sb = new StringBuilder("Search structure: ");

            sb.Append(prefix);
            for (int i = 0; i < maxDepth - 1; i++)
            {
                sb.Append("<...>");
                sb.Append(wordSeperator);
            }
            sb.Append("<...>");
            sb.Append(postfix);
            Console.WriteLine(sb);

            if (prefix + postfix != string.Empty)
            {
                HashComparer.CheckString("", prefix, postfix);
            }

            if (maxDepth >= 1)
            {
                for (int i = 0; i < guessWords.Length; i++)
                {
                    HashComparer.CheckString(guessWords[i], prefix, postfix);

                    if (maxDepth > 1)
                    {
                        WordsRecurse(1, maxDepth, guessWords[i], i);
                    }
                }
            }
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Stopwatch stopWatch = new Stopwatch();

            int depth = 5;

            string[] dictionaryWords = Properties.Resources.Dictionary.Replace('\r', '\n').Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);
            string[] guessWords      = Properties.Resources.GuessWords.Replace('\r', '\n').Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);

            HashComparer.SetHashesToSeek(new string[] { "86da1dadaf37" }); // "60db807ad6c6" TENSION_NECK //  other MESH_ for quiet rain scene"6597da72c376", "a92e1cb18e44", "ab91044b7ba0", <- muscles
            stopWatch.Start();
            Console.WriteLine("Beginning Search, Depth: " + depth + "...");

            CharacterCombiner CC = new CharacterCombiner(depth, "MESH_", "");

            CC.StartCharactersComboSearch(LowerCaseFrequency);

            /*
             * CC.StartCharactersComboSearchMustContain("_", LowerCaseFrequency);
             * foreach (string guessword in guessWords)
             * {
             *  Console.WriteLine("Guessing for: " + guessword);
             *  CC.StartCharactersComboSearchMustContain(guessword, LowerCaseFrequency);
             * }
             */

            /*
             * Console.WriteLine("Lowercase search...");
             * WordCombiner WC = new WordCombiner(3, "qui_body", "");
             * string[] combinationWords = dictionaryWords;
             * WC.StartWordsComboSearch(combinationWords, "_");
             * Console.WriteLine("First letter Uppercase search...");
             * combinationWords = WordCombiner.FirstLetterToUpperCaseAll(combinationWords);
             * WC.StartWordsComboSearch(combinationWords, "_");
             * Console.WriteLine("Uppercase search...");
             * combinationWords = WordCombiner.ToUpperCaseAll(combinationWords);
             * WC.StartWordsComboSearch(combinationWords, "_");
             */

            //string[] combinationWords = dictionaryWords;
            //WordCombiner WC = new WordCombiner(36, "", "");
            //Console.WriteLine("Sai's suggested collision search...");
            //WC.StartWordsComboSearch(combinationWords, "");

            stopWatch.Stop();
            TimeSpan ts          = stopWatch.Elapsed;
            string   elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}",
                                                 ts.Hours, ts.Minutes, ts.Seconds,
                                                 ts.Milliseconds / 10);

            Console.WriteLine("End Reached, Count: " + HashComparer.getCount());
            Console.WriteLine("Elapsed time: " + elapsedTime);
            Console.ReadLine();
        }
        private void CharacterRecurseMustContain(int currentDepth, string baseString, char[] characters)
        {
            foreach (char character in characters)
            {
                string combined = string.Join(string.Empty, baseString, character);
                HashComparer.CheckStringMustContain(combined, mustContain, prefix, postfix);

                if (currentDepth + 1 < maxDepth)
                {
                    CharacterRecurseMustContain(currentDepth + 1, combined, characters);
                }
            }
        }
        private void WordsRecurse(int currentDepth, int maxDepth, string baseString, int wordIndex)
        {
            for (int i = 0; i < guessWords.Length; i++)
            {
                if (i == wordIndex)
                {
                    continue;
                }

                string combined = String.Join(wordSeperator, baseString, guessWords[i]);
                HashComparer.CheckString(combined, prefix, postfix);

                if (currentDepth + 1 < maxDepth)
                {
                    WordsRecurse(currentDepth + 1, maxDepth, combined, i);
                }
            }
        }
        public void StartCharactersComboSearch(char[] characters)
        {
            if (prefix + postfix != string.Empty)
            {
                HashComparer.CheckString("", prefix, postfix);
            }

            if (maxDepth > 0)
            {
                foreach (char character in characters)
                {
                    string charToStr = character.ToString();
                    HashComparer.CheckString(charToStr, prefix, postfix);
                    if (maxDepth > 1)
                    {
                        CharacterRecurse(1, charToStr, characters);
                    }
                }
            }
        }
        public void StartCharactersComboSearchMustContain(string _mustContain, char[] characters)
        {
            mustContain = _mustContain;

            if (prefix + mustContain + postfix != string.Empty)
            {
                HashComparer.CheckString(mustContain, prefix, postfix);
            }

            if (maxDepth > 0)
            {
                foreach (char character in characters)
                {
                    string charToStr = character.ToString();
                    HashComparer.CheckStringMustContain(charToStr, mustContain, prefix, postfix);
                    if (maxDepth > 1)
                    {
                        CharacterRecurseMustContain(1, charToStr, characters);
                    }
                }
            }
        }