Skip to content

ermogenes/SaltedPassword

Repository files navigation

SaltedPassword

A simple utility to create and test salted-hash password with PBKDF2/SHA256

Build and deploy to NuGet

Usage

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

Test

git clone https://github.com/ermogenes/SaltedPassword
cd SaltedPassword
dotnet test

Reference

OWASP Password Storage Cheat Sheet

License

MIT License