Example #1
0
        static void MatchHashes(ArchiveFileManager manager, string sourcesPath)
        {
            var hashForcer = new HashForcer(true);

            hashForcer.LoadHashes(manager);
            hashForcer.LoadSources(sourcesPath);
            hashForcer.Run(Environment.ProcessorCount);
            hashForcer.WaitFinish();
            var result = hashForcer.GetResult();

            Console.WriteLine("Done!");
            Console.WriteLine("Found {0} sections", result.SectionCount);
            Console.WriteLine("Found {0} total hashes", result.HashCount);
            Console.WriteLine("Missing {0} hashes", hashForcer.HashCount - result.HashCount);
            var resultJson = JsonConvert.SerializeObject(result, Formatting.Indented);

            File.WriteAllText("result.json", resultJson);
            Console.WriteLine("Saved findings to a result.json");
        }
        public void HashStrings()
        {
            var hashForcer = new HashForcer(true);

            hashForcer.SetHashes(_hashes);
            hashForcer.SetSources(_strings);
            hashForcer.Run(Environment.ProcessorCount);
            hashForcer.WaitFinish();
            var mapping = new LeagueHashCollection(hashForcer.GetResult());

            var result = new LeagueHashCollection();

            foreach (var hash in mapping.Hashes)
            {
                var sectionFilterer = new SectionFilterer(hash.Value);
                sectionFilterer.ApplyFilter(new FilterPlaintextSections());
                sectionFilterer.ApplyFilter(new FilterDuplicateSections());
                sectionFilterer.ApplyFilter(new FilterPlaintextKeys());
                result.Hashes.Add(hash.Key, sectionFilterer.CurrentSections);
            }
            _draft = result;
        }