27 lines
732 B
C#
27 lines
732 B
C#
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;
|
|
}
|
|
}
|
|
}
|