Exemplo n.º 1
0
 /// <summary>
 /// Creates a Hash for a new password. Static utility method provided for convienance to the developer.
 /// </summary>
 /// <returns>The hash.</returns>
 /// <param name="passwordToHash">Password to hash.</param>
 public static string CreateHash(string passwordToHash)
 {
     var hasher = new Hasher();
     var hashedPassword =
         hasher.CreateHashUsingDefaultAlgorithm(passwordToHash);
     return hashedPassword;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Gets a hash value for an existing password. Static utility method provided for convienance to the developer.
 /// </summary>
 /// <returns>The hash.</returns>
 /// <param name="plainTextPassword">Plain text password.</param>
 /// <param name="existingHashedValue">Existing hashed value.</param>
 public static string GetHash(string plainTextPassword, string existingHashedValue)
 {
     var hasher = new Hasher();
     var salt = hasher.GetSalt(existingHashedValue);
     var hashedPassword =
         hasher.VerifyHashUsingDefaultAlgorithm(plainTextPassword, salt);
     return hashedPassword;
 }