C# formatting
This commit is contained in:
@@ -21,18 +21,15 @@ public static class PasswordHasher
|
||||
|
||||
public static bool Verify(string password, byte[] hash, byte[] salt)
|
||||
{
|
||||
if (hash is null || salt is null || hash.Length == 0 || salt.Length == 0) return false;
|
||||
if (hash.Length == 0 || salt.Length == 0)
|
||||
return false;
|
||||
|
||||
var computed = PBKDF2(password, salt);
|
||||
return CryptographicOperations.FixedTimeEquals(computed, hash);
|
||||
}
|
||||
|
||||
private static byte[] PBKDF2(string password, byte[] salt)
|
||||
{
|
||||
return Rfc2898DeriveBytes.Pbkdf2(
|
||||
Encoding.UTF8.GetBytes(password),
|
||||
salt,
|
||||
Iterations,
|
||||
HashAlgorithmName.SHA256,
|
||||
KeySize);
|
||||
return Rfc2898DeriveBytes.Pbkdf2(Encoding.UTF8.GetBytes(password), salt, Iterations, HashAlgorithmName.SHA256, KeySize);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user