public Password(string password, byte[] salt) { var hashSenha = new PasswordHashCalculator(password, salt); Hash = hashSenha.PasswordHash; Salt = hashSenha.PasswordSalt; }
public void ShouldNeverCalculateSameHashAndSaltToSamePassword() { var password = "******"; var firstHashCalc = new PasswordHashCalculator(password); var newHashCalc = new PasswordHashCalculator(password); firstHashCalc.PasswordHash.Should().NotBeEquivalentTo(newHashCalc.PasswordHash); firstHashCalc.PasswordSalt.Should().NotBeEquivalentTo(newHashCalc.PasswordSalt); }
public void ShouldBeEqualWhenUseTheKey() { var password = "******"; var originalHashCalc = new PasswordHashCalculator(password); var key = originalHashCalc.PasswordSalt; var hashCalcWithKey = new PasswordHashCalculator(password, key); originalHashCalc.Should().BeEquivalentTo(hashCalcWithKey); }
public UserService(IOptions <AuthSettings> appSettings, GraphLabsContext ctx, PasswordHashCalculator hashCalculator) { _ctx = ctx; _hashCalculator = hashCalculator; _appSettings = appSettings.Value; }