Class PasswordHash
- Namespace
- ArcanaDevelopment.adTempus.Shared
- Assembly
- ArcanaDevelopment.adTempus.Shared.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 static class PasswordHash
- Inheritance
-
objectPasswordHash
Fields
HASH_BYTES
public const int HASH_BYTES = 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_BYTES
public const int SALT_BYTES = 24
Field Value
- int
SALT_INDEX
public const int SALT_INDEX = 1
Field Value
- int
Methods
CreateHash(byte[], byte[])
public static string CreateHash(byte[] password, byte[] salt)
Parameters
| Name | Type | Description |
|---|---|---|
password |
byte[] | |
salt |
byte[] |
Returns
- string
CreateHash(string)
Creates a salted PBKDF2 hash of the password.
public static string CreateHash(string password)
Parameters
| Name | Type | Description |
|---|---|---|
password |
string | The password to hash. |
Returns
- string
The hash of the password.
CreateHash(string, byte[])
Creates a salted PBKDF2 hash of the password.
public static string CreateHash(string password, byte[] salt)
Parameters
| Name | Type | Description |
|---|---|---|
password |
string | The password to hash. |
salt |
byte[] |
Returns
- string
The hash of the password.
CreateHashWithDefaultSalt(byte[])
public static string CreateHashWithDefaultSalt(byte[] password)
Parameters
| Name | Type | Description |
|---|---|---|
password |
byte[] |
Returns
- string
CreateHashWithDefaultSalt(string)
public static string CreateHashWithDefaultSalt(string password)
Parameters
| Name | Type | Description |
|---|---|---|
password |
string |
Returns
- string
ValidatePassword(string, string)
Validates a password given a hash of the correct one.
public static bool ValidatePassword(string password, string goodHash)
Parameters
| Name | Type | Description |
|---|---|---|
password |
string | The password to check. |
goodHash |
string | A hash of the correct password. |
Returns
- bool
True if the password is correct. False otherwise.