📜  c#系统加密哈希字符串 - C#代码示例

📅  最后修改于: 2022-03-11 14:49:20.454000             🧑  作者: Mango

代码示例1
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);