C# formatting

This commit is contained in:
2026-02-05 20:39:12 +01:00
parent 78cdbfe51e
commit c0756ff2c6
34 changed files with 830 additions and 582 deletions

View File

@@ -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);
}
}