/FluffySpoon.Security

Provides mechanisms for hashing.

Primary LanguageC#MIT LicenseMIT

FluffySpoon.Security

Provides mechanisms for hashing.

Currently uses Argon2 - the best password hashing algorithm as of the 8th of November, 2018.

This package will always be updated to contain the most secure hashing implementation. Since it prefixes the method used in the hash (which is considered secure), it can automatically verify hashes that were generated with older implementations of the library.

Setup

services.AddFluffySpoonHasher(/* optional pepper can be provided here */);

Use

Inject an IHasher into your class. In the following example, the IHasher instance is in the variable hasher.

var passwordToHash = "my_totally_safe_password";

var hash = hasher.Generate(passwordToHash);

//isHashValid will now be true since the hash corresponds to the entered password.
var isHashValid = hasher.Verify(hash, passwordToHash);

//isHashUpToDate will be true since "hash" was created using the latest hashing mechanism. useful for migrating old hashes.
var isHashUpToDate = hasher.IsHashUpToDate(hash);