PasswordHasher<TUser> Class

Implements the standard Identity password hashing.

Namespace
Microsoft.AspNetCore.Identity
Assemblies
  • Microsoft.AspNetCore.Identity

Syntax

public class PasswordHasher<TUser> : IPasswordHasher<TUser> where TUser : class
class Microsoft.AspNetCore.Identity.PasswordHasher<TUser>

Constructors

PasswordHasher(Microsoft.Extensions.Options.IOptions<Microsoft.AspNetCore.Identity.PasswordHasherOptions>)

Creates a new instance of Microsoft.AspNetCore.Identity.PasswordHasher`1.

Arguments:optionsAccessor (Microsoft.Extensions.Options.IOptions<Microsoft.AspNetCore.Identity.PasswordHasherOptions>) – The options for this instance.
public PasswordHasher(IOptions<PasswordHasherOptions> optionsAccessor = null)

Methods

HashPassword(TUser, System.String)

Returns a hashed representation of the supplied <em>password</em> for the specified <em>user</em>.

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 <em>password</em> for the specified <em>user</em>.

public virtual string HashPassword(TUser user, string password)
VerifyHashedPassword(TUser, System.String, System.String)

Returns a Microsoft.AspNetCore.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.AspNetCore.Identity.PasswordVerificationResult

Returns:

A Microsoft.AspNetCore.Identity.PasswordVerificationResult indicating the result of a password hash comparison.

public virtual PasswordVerificationResult VerifyHashedPassword(TUser user, string hashedPassword, string providedPassword)