Files
Hushian/Hushian.Application/Services/HashPassword.cs

27 lines
732 B
C#
Raw Normal View History

2025-06-29 16:14:42 +03:30
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;
}
}
}