public SecretPhrasesFinder(PhraseGenerator phraseGenerator, string[] hashes) { _phraseGenerator = phraseGenerator; _hashes = hashes; _phrasesToCheck = new BlockingCollection <string>(1); _results = new ConcurrentBag <string>(); }
public static void Main() { const string resultPath = @".\datafiles\result"; const string anagram = "poultry outwits ants"; var hashes = GetHashesList(@".\datafiles\hashes"); var words = GetWordsList(@".\datafiles\wordlist"); var stopWatch = new Stopwatch(); stopWatch.Start(); var phraseGenerator = new PhraseGenerator(anagram, words); var tasksManager = new SecretPhrasesFinder(phraseGenerator, hashes); var result = tasksManager.FindSecretPhrases(); stopWatch.Stop(); result.Add(stopWatch.Elapsed.TotalMinutes.ToString(CultureInfo.InvariantCulture)); Console.WriteLine("----------------------"); Console.WriteLine(string.Join(" ", result)); WriteResult(resultPath, result.ToArray()); }