DocumentManager/Utils/PasswordHash.cs
/// <summary>
/// Validates a password given a hash of the correct one.
/// </summary>
/// <param name="password">The password to check.</param>
/// <param name="correctHash">A hash of the correct password.</param>
/// <returns>True if the password is correct. False otherwise.</returns>
Validates a password given a hash of the correct one.
Validates a password given a hash of the correct one .
public static bool ValidatePassword(string password, string correctHash) {
			string[] split = correctHash.Split(':');
			byte[] salt = Convert.FromBase64String(split[0]);
			byte[] hash = Convert.FromBase64String(split[1]);
			byte[] testHash = PBKDF2(password, salt, 1024, hash.Length);
			return SlowEquals(hash, testHash);
		}
public static bool ValidatePassword ( string password , string correctHash ) { string [ ] split = correctHash . Split ( ' ' ) ; byte [ ] salt = Convert . FromBase64String ( split [ 0 ] ) ; byte [ ] hash = Convert . FromBase64String ( split [ 1 ] ) ; byte [ ] testHash = PBKDF2 ( password , salt , 1024 , hash . Length ) ; return SlowEquals ( hash , testHash ) ; }
Validates a password given a hash of the correct one.
Validates a password given a hash of the correct one .
// Extract the parameters from the hash
True if the password is correct. False otherwise.
True if the password is correct . False otherwise .
password
string
The password to check.
The password to check .
correctHash
string
A hash of the correct password.
A hash of the correct password .