Example #1
0
        public static void Main(string[] args)
        {
            var result = CommandLine.Parser.Default.ParseArguments <Options>(args);

            result.WithParsed(opts =>
            {
                SHA256MessageFinder.LookForMessageWithHashPattern(opts.OutputFileName, "AA", "BB");
            });
            Environment.Exit(0);
        }
        //[TestCase("AA","BB", "CC")]
        public void Test(params string[] pattern)
        {
            var result = SHA256MessageFinder.LookForMessageWithHashPattern(null, pattern);

            // check if result was found
            Assert.NotNull(result);

            // check if pattern matches its SHA-256 hash
            var sha256 = SHA256.Create();
            var hash   = sha256.ComputeHash(result);

            Assert.True(!pattern.Where((element, index) => Convert.ToByte(element, 16) != hash[index]).Any());
        }