C# Class OpenResKit.ODataHost.PasswordHash

Salted password hashing with PBKDF2-SHA1. Author: havoc AT defuse.ca www: http://crackstation.net/hashing-security.htm Compatibility: .NET 3.0 and later.
Show file Open project: htw-bui/OrkHub

Public Methods

Method Description
CreateHash ( string password ) : string

Creates a salted PBKDF2 hash of the password.

ValidatePassword ( string password, string correctHash ) : bool

Validates a password given a hash of the correct one.

Private Methods

Method Description
PBKDF2 ( string password, byte salt, int iterations, int outputBytes ) : byte[]

Computes the PBKDF2-SHA1 hash of a password.

SlowEquals ( byte a, byte b ) : bool

Compares two byte arrays in length-constant time. This comparison method is used so that password hashes cannot be extracted from on-line systems using a timing attack and then attacked off-line.

Method Details

CreateHash() public static method

Creates a salted PBKDF2 hash of the password.
public static CreateHash ( string password ) : string
password string The password to hash.
return string

ValidatePassword() public static method

Validates a password given a hash of the correct one.
public static ValidatePassword ( string password, string correctHash ) : bool
password string The password to check.
correctHash string A hash of the correct password.
return bool