PasswordHasher Class

Summary

Implements the standard Identity password hashing.

Syntax

public class PasswordHasher : IPasswordHasher

GitHub

View on GitHub

class Microsoft.AspNet.Identity.PasswordHasher

Constructors

PasswordHasher(IOptions<Microsoft.AspNet.Identity.PasswordHasherOptions>)

Creates a new instance of PasswordHasher&lt;TUser&gt;.

public PasswordHasher(IOptions<PasswordHasherOptions> optionsAccessor = null)

Methods

HashPassword<TUser>(TUser, System.String)

Returns a hashed representation of the supplied password for the specified user.

Arguments:
  • user ({TUser}) – The user whose password is to be hashed.
  • password (System.String) – The password to hash.
Return type:

System.String

Returns:

A hashed representation of the supplied <paramref name=”password” /> for the specified <paramref name=”user” />.

public virtual string HashPassword<TUser>(TUser user, string password)where TUser : class
VerifyHashedPassword<TUser>(TUser, System.String, System.String)

Returns a Microsoft.AspNet.Identity.PasswordVerificationResult indicating the result of a password hash comparison.

Arguments:
  • user ({TUser}) – The user whose password should be verified.
  • hashedPassword (System.String) – The hash value for a user’s stored password.
  • providedPassword (System.String) – The password supplied for comparison.
Return type:

Microsoft.AspNet.Identity.PasswordVerificationResult

Returns:

A <see cref=”T:Microsoft.AspNet.Identity.PasswordVerificationResult” /> indicating the result of a password hash comparison.

public virtual PasswordVerificationResult VerifyHashedPassword<TUser>(TUser user, string hashedPassword, string providedPassword)where TUser : class