Ejemplo n.º 1
0
 /// <summary>
 /// Compare a given salt and password to a previously hashed password.
 /// </summary>
 /// <param name="delegate">The current <see cref="PasswordComparer"/> implementation.</param>
 /// <param name="salt">A sequence of bytes representing the salt.</param>
 /// <param name="password">A string representing the clear password.</param>
 /// <param name="hashed">
 /// A sequence of bytes representing a previous result of hashing a salt and password.
 /// </param>
 /// <param name="encoding">
 /// An encoding to use to convert the given password to an array of bytes.
 /// </param>
 /// <returns>
 /// A value indicating whether or not the given salt and password equals the given hashed password.
 /// </returns>
 public static bool Compare(
     this PasswordComparer @delegate,
     byte[] salt,
     string password,
     byte[] hashed,
     Encoding encoding
     )
 {
     return(@delegate.Invoke(salt, encoding.GetBytes(password), hashed));
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Compare a given salt and password to a previously hashed password.
 /// </summary>
 /// <param name="delegate">The current <see cref="PasswordComparer"/> implementation.</param>
 /// <param name="salt">A sequence of bytes representing the salt.</param>
 /// <param name="password">A sequence of bytes representing the clear password.</param>
 /// <param name="hashed">
 /// A sequence of bytes representing a previous result of hashing a salt and password.
 /// </param>
 /// <returns>
 /// A value indicating whether or not the given salt and password equals the given hashed password.
 /// </returns>
 public static bool Compare(this PasswordComparer @delegate, byte[] salt, byte[] password, byte[] hashed)
 {
     return(@delegate.Invoke(salt, password, hashed));
 }