コード例 #1
0
        public HashedPassword GeneratePasswordHashAndSalt(PlaintextPassword password)
        {
            var saltBytes = Rng.GetRandomBytes(Parameters.SaltLength.Value);
            var salt      = Convert.ToBase64String(saltBytes);

            var hashBytes = KeyDerivation.Pbkdf2(password.Value, saltBytes, Parameters.DerivationFunction,
                                                 Parameters.IterationCount.Value, Parameters.KeyLength.Value);
            var hash = Convert.ToBase64String(hashBytes);

            return(new HashedPassword(Base64Hash.From(hash), Base64Salt.From(salt)));
        }
コード例 #2
0
 public HashedPassword(Base64Hash passwordHash, Base64Salt salt)
 {
     Base64PasswordHash = passwordHash;
     Base64Salt         = salt;
 }