A simple utility to create and test salted-hash password with PBKDF2/SHA256
Add the package to your project:
dotnet add package Ermogenes.SaltedPassword
using Ermogenes.SaltedPassword;Getting a key from a clear password:
string keyToStore = SaltedPassword.GetPersistentKey(clearPassword);The value of keyToStore is a salted-hash from the clearPassword, and may be stored.
The format:
base64-salt|number-of-iterations|base64-hash
Testing a password for equality:
bool passwordMatch = SaltedPassword.Match(clearPasswordToMatch, storedKey);git clone https://github.com/ermogenes/SaltedPassword
cd SaltedPassword
dotnet test