Table of Contents

Class PasswordHash

Namespace
Shift.Common
Assembly
Shift.Common.dll

Salted password hashing with PBKDF2-SHA1. Author: havoc AT defuse.ca www: http://crackstation.net/hashing-security.htm Compatibility: .NET 3.0 and later.

public class PasswordHash
Inheritance
PasswordHash
Inherited Members
Extension Methods

Constructors

PasswordHash()

public PasswordHash()

Fields

HASH_BYTE_SIZE

public const int HASH_BYTE_SIZE = 24

Field Value

int

ITERATION_INDEX

public const int ITERATION_INDEX = 0

Field Value

int

PBKDF2_INDEX

public const int PBKDF2_INDEX = 2

Field Value

int

PBKDF2_ITERATIONS

public const int PBKDF2_ITERATIONS = 1000

Field Value

int

SALT_BYTE_SIZE

public const int SALT_BYTE_SIZE = 24

Field Value

int

SALT_INDEX

public const int SALT_INDEX = 1

Field Value

int

Methods

CreateHash(string)

Creates a salted PBKDF2 hash of the password.

public static string CreateHash(string password)

Parameters

password string

The password to hash.

Returns

string

The hash of the password.

ValidatePassword(string, string)

Validates a password given a hash of the correct one.

public static bool ValidatePassword(string password, string correctHash)

Parameters

password string

The password to check.

correctHash string

A hash of the correct password.

Returns

bool

True if the password is correct. False otherwise.