Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mununki/passwordhasher.sha256.asp.net.core.identity
A NuGet package to use the custom password hasher - SHA256 & BASE64 encoding
https://github.com/mununki/passwordhasher.sha256.asp.net.core.identity
Last synced: 29 days ago
JSON representation
A NuGet package to use the custom password hasher - SHA256 & BASE64 encoding
- Host: GitHub
- URL: https://github.com/mununki/passwordhasher.sha256.asp.net.core.identity
- Owner: mununki
- Created: 2019-09-06T03:20:07.000Z (over 5 years ago)
- Default Branch: develop
- Last Pushed: 2019-09-06T08:16:35.000Z (over 5 years ago)
- Last Synced: 2024-04-24T03:22:04.889Z (9 months ago)
- Language: C#
- Size: 3.91 KB
- Stars: 1
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# PasswordHasher.SHA256.ASP.NET.CORE.Identity
This is a package to use the custom password hasher with `SHA256` algorithm and `base64` encoding for IdentityServer4 or any `ASP.NET Core` project using `Microsoft.AspNetCore.Identity` dependency.
> Generated hashed value structure
```
[SHA256 hashed + BASE64 encoded password]$[Guid salt]# e.g. W9G4GjOAE47HKq2ktI/RXhYBgqv5vIsWYF5GfR5jy7o=$e6126315-2425-4aa2-bfba-0986e49590e8
```The salt value after `$` which was generated using `System.Guid` will be used to verify the password which is input by user.
## Installation
### dotnet CLI
```shell
$ dotnet add package PasswordHasher.SHA256.ASP.NET.CORE.Identity
```### NuGet
https://www.nuget.org/packages/PasswordHasher.SHA256.ASP.NET.CORE.Identity## Usage
```csharp
// Startup.csusing SHA256Hasher;
public void ConfigureServices(IServiceCollection services)
{
var connectionString = Configuration.GetConnectionString("DefaultConnection");
var migrationsAssembly = typeof(Startup).GetTypeInfo().Assembly.GetName().Name;// ADD CustomPasswordHasher
services.AddTransient, CustomPasswordHasher>();
// omit the rest of codes
```## Demo
```shell
$ cd console
$ dotnet run# The provided password "StrongPassw0rd!"
HashedValue > W9G4GjOAE47HKq2ktI/RXhYBgqv5vIsWYF5GfR5jy7o=$e6126315-2425-4aa2-bfba-0986e49590e8
Verify > Success
```