public void HashPassword_Twice_BothVerified()
        {
            var kdf = new KeyDerivationFunction();

            var hash1   = kdf.HashPassword(Pass);
            var hash2   = kdf.HashPassword(Pass);
            var result1 = kdf.VerifyHashedPassword(hash1, Pass);
            var result2 = kdf.VerifyHashedPassword(hash2, Pass);

            Assert.IsTrue(result1);
            Assert.IsTrue(result2);
        }
        public void HashVerify_SamePassword_True()
        {
            var kdf = new KeyDerivationFunction();

            var hash   = kdf.HashPassword(Pass);
            var result = kdf.VerifyHashedPassword(hash, Pass);

            Assert.IsTrue(result);
        }
        public void HashVerify_DifferentPassword_False()
        {
            var kdf = new KeyDerivationFunction();

            var hash   = kdf.HashPassword(Pass);
            var result = kdf.VerifyHashedPassword(hash, Pass + "1");

            Assert.IsFalse(result);
        }
Esempio n. 4
0
 public override PasswordVerificationResult VerifyHashedPassword(string hashedPassword, string providedPassword)
 {
     return(_hasher.VerifyHashedPassword(hashedPassword, providedPassword)
         ? PasswordVerificationResult.Success
         : PasswordVerificationResult.Failed);
 }