📅  最后修改于: 2022-03-11 14:49:20.454000             🧑  作者: Mango
public static string StringSha256Hash(string text) =>
string.IsNullOrEmpty(text) ?
string.Empty : // Return string back if its empty
BitConverter.ToString( // Encrypt
new System.Security.Cryptography.SHA256Managed().ComputeHash(
System.Text.Encoding.UTF8.GetBytes(text))
).Replace("-", string.Empty);