示例#1
0
 /// <summary>
 /// The generate salt.
 /// </summary>
 /// <returns>
 /// The
 /// <see>
 ///     <cref>byte[]</cref>
 /// </see>
 /// .
 /// </returns>
 protected byte[] GenerateSalt()
 {
     return(HashPasswordUtils.RandomSalt(this.HashByteLength));
 }
示例#2
0
 /// <summary>
 /// The validate.
 /// </summary>
 /// <param name="password">
 /// The password.
 /// </param>
 /// <param name="salt">
 /// The salt.
 /// </param>
 /// <param name="goodHash">
 /// The good hash.
 /// </param>
 /// <returns>
 /// The <see cref="bool"/>.
 /// </returns>
 protected bool Validate(string password, byte[] salt, byte[] goodHash)
 {
     byte[] hash = this.Generate(password, salt);
     return(HashPasswordUtils.SlowEquals(hash, goodHash));
 }
示例#3
0
 /// <summary>
 /// The generate.
 /// </summary>
 /// <param name="password">
 /// The password.
 /// </param>
 /// <param name="salt">
 /// The salt.
 /// </param>
 /// <returns>
 /// The
 /// <see>
 ///     <cref>byte[]</cref>
 /// </see>
 /// .
 /// </returns>
 protected byte[] Generate(string password, byte[] salt)
 {
     byte[] bytes    = HashPasswordUtils.BlockCopy(password);
     byte[] combined = HashPasswordUtils.Combine(salt, bytes);
     return(this.ComputeHash(combined));
 }