Exemple #1
0
        public async Task TestParseLineAsync(string line, int expectedrowCount)
        {
            var message = new HttpResponseMessage(System.Net.HttpStatusCode.OK)
            {
                Content = new StringContent(line),
            };

            var lines = await PasswordLookup.ParseLinesAsync(message);

            Assert.AreEqual(expectedrowCount, lines.Count());
        }
        static async Task Main(string[] args)
        {
            while (true)
            {
                System.Console.Write("Enter password to test: ");
                var password = System.Console.ReadLine();
                var result   = await PasswordLookup.LookupAsync(password);

                if (result)
                {
                    System.Console.WriteLine($"Password is public and was found {result.HitCount} time(s)");
                }
                else
                {
                    System.Console.WriteLine("Password was not found in the wild.");
                }

                System.Console.WriteLine();
            }
        }
Exemple #3
0
        public void TestSHA1Hash(string password, string hash)
        {
            var result = PasswordLookup.HashPassword(password);

            Assert.AreEqual(hash, result, true);
        }
Exemple #4
0
        public void TestParseHitCount(string line, int hitCountAssert)
        {
            var hitCount = PasswordLookup.ParseHitCount(line);

            Assert.AreEqual(hitCountAssert, hitCount);
        }