public void VerifyHashedPassword_WhenPasswordCreatedWithEnhancedEntropyButVerifiedWithout_ExpectFailure() { var options = new BCryptPasswordHasherOptions { EnhancedEntropy = true }; var password = Guid.NewGuid().ToString(); var hashedPassword = BCrypt.Net.BCrypt.HashPassword(password, options.WorkFactor); var hasher = new BCryptPasswordHasher <string>(new OptionsWrapper <BCryptPasswordHasherOptions>(options)); hasher.VerifyHashedPassword("", hashedPassword, password).Should().Be(PasswordVerificationResult.Failed); }
public void VerifyHashedPassword_WithEnhancedEntropy_ExpectSuccess() { var options = new BCryptPasswordHasherOptions { EnhancedEntropy = true }; var password = Guid.NewGuid().ToString(); var hashedPassword = BCrypt.Net.BCrypt.HashPassword(password, options.WorkFactor, true); var hasher = new BCryptPasswordHasher <string>(new OptionsWrapper <BCryptPasswordHasherOptions>(options)); hasher.VerifyHashedPassword("", hashedPassword, password).Should().Be(PasswordVerificationResult.Success); }