exper
This commit is contained in:
26
Hushian.Application/Services/HashPassword.cs
Normal file
26
Hushian.Application/Services/HashPassword.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using Microsoft.AspNetCore.Cryptography.KeyDerivation;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hushian.Application.Services
|
||||
{
|
||||
public static class HashPassword
|
||||
{
|
||||
|
||||
|
||||
public static string GetHash(this string Password)
|
||||
{
|
||||
string hashed = Convert.ToBase64String(KeyDerivation.Pbkdf2(
|
||||
password: Password!,
|
||||
salt: Encoding.ASCII.GetBytes("CGYzqejKH50&kjh(02**Id1Q"),
|
||||
prf: KeyDerivationPrf.HMACSHA256,
|
||||
iterationCount: 100000,
|
||||
numBytesRequested: 256 / 8));
|
||||
return hashed;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user