https://github.com/ffmathy/fluffyspoon.security
Provides mechanisms for hashing.
https://github.com/ffmathy/fluffyspoon.security
Last synced: over 1 year ago
JSON representation
Provides mechanisms for hashing.
- Host: GitHub
- URL: https://github.com/ffmathy/fluffyspoon.security
- Owner: ffMathy
- License: mit
- Created: 2018-02-25T17:56:52.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-03-24T22:45:31.000Z (over 3 years ago)
- Last Synced: 2024-05-22T22:32:48.219Z (about 2 years ago)
- Language: C#
- Homepage:
- Size: 27.3 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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](https://security.stackexchange.com/questions/197236/is-it-bad-practice-to-prefix-my-hash-with-the-algorithm-used)), it can automatically verify hashes that were generated with older implementations of the library.
## Setup
```csharp
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`.
```csharp
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);
```