我需要使用一种算法来将用户密码散列到.net核心项目中,该算法更安全,更快速地生成方法。
我不想将任何外部软件包添加到我的项目中
你可以用这种方法
public string GetSha256Hash(string input)
{
using (var hashAlgorithm = new SHA256CryptoServiceProvider())
{
var byteValue = Encoding.UTF8.GetBytes(input);
var byteHash = hashAlgorithm.ComputeHash(byteValue);
return Convert.ToBase64String(byteHash);
}
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句