Beispiel #1
0
        public Password(string password, byte[] salt)
        {
            var hashSenha = new PasswordHashCalculator(password, salt);

            Hash = hashSenha.PasswordHash;
            Salt = hashSenha.PasswordSalt;
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        public void ShouldBeEqualWhenUseTheKey()
        {
            var password         = "******";
            var originalHashCalc = new PasswordHashCalculator(password);

            var key             = originalHashCalc.PasswordSalt;
            var hashCalcWithKey = new PasswordHashCalculator(password, key);

            originalHashCalc.Should().BeEquivalentTo(hashCalcWithKey);
        }
Beispiel #4
0
 public UserService(IOptions <AuthSettings> appSettings, GraphLabsContext ctx, PasswordHashCalculator hashCalculator)
 {
     _ctx            = ctx;
     _hashCalculator = hashCalculator;
     _appSettings    = appSettings.Value;
 }