using Microsoft.AspNetCore.Identity;
public static void Main()
string password = "Pass@123";
string hashed =CryptoHelper.HashString(password);
Console.WriteLine(hashed);
Console.WriteLine(CryptoHelper.VerifyHashedString(hashed,password));
public sealed class CryptoHelper{
public static bool VerifyHashedString(string hashedValue, string value)
PasswordHasher<CryptoHelper> passwordHasher = new PasswordHasher<CryptoHelper>();
PasswordVerificationResult verifyRes = passwordHasher.VerifyHashedPassword(null, hashedValue, value);
return verifyRes != PasswordVerificationResult.Failed;
public static string HashString(string value)
PasswordHasher<CryptoHelper> passwordHasher = new PasswordHasher<CryptoHelper>();
return passwordHasher.HashPassword(null, value);