Skip to main content

IPasswordHasher

The Password Hasher provider used to hash users passwords, by default uses the same algorithm used by ASP.NET Identity v3: PBKDF2 with HMAC-SHA256, 128-bit salt, 256-bit subkey, 10000 iterations.

Assembly: ServiceStack.Interfaces.dll
View Source
Declaration
public interface IPasswordHasher

Properties

Version

The first byte marker used to specify the format used. The default implementation uses the following format: { 0x01, prf (UInt32), iter count (UInt32), salt length (UInt32), salt, subkey }

View Source
Declaration
byte Version { get; }

Methods

VerifyPassword(String, String, out Boolean)

Returns a boolean indicating whether the <code data-dev-comment-type="paramref" class="paramref">providedPassword</code> matches the <code data-dev-comment-type="paramref" class="paramref">hashedPassword</code>. The <code data-dev-comment-type="paramref" class="paramref">needsRehash</code> out parameter indicates whether the password should be re-hashed.

Implementations of this method should be time consistent.

View Source
Declaration
bool VerifyPassword(string hashedPassword, string providedPassword, out bool needsRehash)
Returns

System.Boolean

Parameters
TypeNameDescription
System.StringhashedPasswordThe hash value for a user's stored password.

Implementations of this method should be time consistent. | | System.String | providedPassword | The password supplied for comparison. Implementations of this method should be time consistent. | | System.Boolean | needsRehash | |

HashPassword(String)

Returns a hashed representation of the supplied <code data-dev-comment-type="paramref" class="paramref">password</code>.

View Source
Declaration
string HashPassword(string password)
Returns

System.String: A hashed representation of the supplied <code data-dev-comment-type="paramref" class="paramref">password</code>.

Parameters
TypeNameDescription
System.StringpasswordThe password to hash.

|