Click or drag to resize

PasswordHash Class

Generates a one-way hashed value using Rfc2898DeriveBytes and 10,000 iterations (slow, in hashing terms) Every hash is unique. To use, you have to compare the value of the stored hash with plain text. This example is taken in part from: http://csharptest.net/470/another-example-of-how-to-store-a-salted-password-hash/
string hashedValue = PasswordHash.HashPassword("mysecretpassword");
bool match = PasswordHash.ValidatePassword("mysecretpassword", hashedValue);
Inheritance Hierarchy
SystemObject
  NetQuarry.SecurityPasswordHash

Namespace:  NetQuarry.Security
Assembly:  EAP.Core (in EAP.Core.dll) Version: 2.0.0.0 (4.6.8.0)
Syntax
public sealed class PasswordHash

The PasswordHash type exposes the following members.

Methods
  NameDescription
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodStatic memberHashPassword
Returns a hashed password using new, randomly-generated, cryptographically-strong salt.
Public methodStatic memberHashPasswordDelimited
Returns a hashed password using new, randomly-generated, cryptographically-strong salt. The returned hash is of the form "base-64-encoded-salt|base-64-encoded-hash".
Public methodToString
Returns a String that represents the current Object.
(Inherited from Object.)
Public methodStatic memberValidatePassword
Validates a plain-text string with a previously hashed string. The provided hash may be a single base-64-encoded salt+hash (as returned by HashPassword(String), or a pipe-delimited salt+hash (as returned by HashPasswordDelimited(String)). Note that this method will never throw even if the provided hash value is not a valid hash.
Top
Extension Methods
  NameDescription
Public Extension MethodEqualValue
Determines if the object value is equal to another object. If the two objects are null, then this returns true. There is special handling for guid comparisons (since a guid could be a string formatted in up to 3 different ways). If the special guid handling is not performed, then the object.Equals method is used.
(Defined by EAPUtil.)
Top
See Also