using System.Security.Cryptography;
using Microsoft.AspNetCore.Cryptography.KeyDerivation;
using Microsoft.Extensions.Options;
public static void Main()
var data ="AOss5E8kCUR1UYqLJ1dy/gcY2Xuoi93gy74uC/hqUcHOI1aCvX6edxFcVtVps2Y/Fg==";
var temppassword ="Temp@1234567";
var data1=VerifyHashedPassword(data,temppassword);
Console.WriteLine(data1);
public static bool VerifyHashedPassword(string hashedPassword, string password)
if (hashedPassword == null)
throw new ArgumentNullException("password");
byte[] src = Convert.FromBase64String(hashedPassword);
if ((src.Length != 0x31) || (src[0] != 0))
byte[] dst = new byte[0x10];
Convert.ToBase64String(dst);
Console.WriteLine(Convert.ToBase64String(dst));
Buffer.BlockCopy(src, 1, dst, 0, 0x10);
byte[] buffer3 = new byte[0x20];
Buffer.BlockCopy(src, 0x11, buffer3, 0, 0x20);
using (Rfc2898DeriveBytes bytes = new Rfc2898DeriveBytes(password, dst, 0x3e8))
buffer4 = bytes.GetBytes(0x20);
return ByteArraysEqual(buffer3, buffer4);
public static bool ByteArraysEqual(byte[] b1, byte[] b2)
if (b1 == b2) return true;
if (b1 == null || b2 == null) return false;
if (b1.Length != b2.Length) return false;
for (int i = 0; i < b1.Length; i++)
if (b1[i] != b2[i]) return false;