public void VerifyHashedPassword_WhenSuppliedPasswordDoesNotMatch_ExpectFailure() { var password = Guid.NewGuid().ToString(); var hashedPassword = PasswordHash.ArgonHashString(Guid.NewGuid().ToString()); var hasher = new Argon2PasswordHasher <string>(); hasher.VerifyHashedPassword("", hashedPassword, password).Should().Be(PasswordVerificationResult.Failed); }
public void VerifyHashedPassword_WithCustomStrength_ExpectSuccess() { var password = Guid.NewGuid().ToString(); var hashedPassword = PasswordHash.ArgonHashString(password, PasswordHash.StrengthArgon.Sensitive); var hasher = new Argon2PasswordHasher <string>(); hasher.VerifyHashedPassword("", hashedPassword, password).Should().Be(PasswordVerificationResult.Success); }
public void VerifyHashedPassword_WithDefaultSettings_ExpectSuccess() { var password = Guid.NewGuid().ToString(); var hashedPassword = PasswordHash.ArgonHashString(password); var hasher = new Argon2PasswordHasher <string>(); hasher.VerifyHashedPassword("", hashedPassword, password).Should().Be(PasswordVerificationResult.Success); }
public void HashPassword_WithDefaultSettings_ExpectVerifiableHash() { var password = Guid.NewGuid().ToString(); var hasher = new Argon2PasswordHasher <string>(); var hashedPassword = hasher.HashPassword("", password); PasswordHash.ArgonHashStringVerify(hashedPassword, password).Should().BeTrue(); }
public void HashPassword_WithCustomStrength_ExpectVerifiableHash() { var password = Guid.NewGuid().ToString(); var hasher = new Argon2PasswordHasher <string>( new OptionsWrapper <Argon2PasswordHasherOptions>( new Argon2PasswordHasherOptions { Strength = Argon2HashStrength.Sensitive })); var hashedPassword = hasher.HashPassword("", password); PasswordHash.ArgonHashStringVerify(hashedPassword, password).Should().BeTrue(); }
public void HashPassword_WithDefaultSettings_ExpectVerifiableHash() { var password = "******"; var hasher = new Argon2PasswordHasher <string>(); var hashedPassword = hasher.HashPassword("", password); output.WriteLine(hashedPassword); //this will produce a 32 byte hash var hash = PasswordHash.ScryptHashString(password); PasswordHash.ArgonHashStringVerify(hashedPassword, password).Should().BeTrue(); }