public static string GetSHA256hash(string input, string _input_charset)
        {
             

            byte[] clearBytes = Encoding.UTF8.GetBytes(input);
            SHA256 sha256 = new SHA256Managed();
            sha256.ComputeHash(clearBytes);
            byte[] hashedBytes = sha256.Hash;
            sha256.Clear();
            string output = BitConverter.ToString(hashedBytes).Replace("-", "").ToLower();

            return output;
        }

先用SHA256Managed计算HASH,然后用BitConverter.ToString转为16进制字符串。这个字符串REPLACE掉“-”后长度为64.

要不要REPLACE,和TOLOWER,看签名要求。

相关文章:

  • 2021-11-14
  • 2021-12-08
  • 2021-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-22
  • 2022-12-23
  • 2022-12-23
  • 2022-01-12
  • 2021-12-02
  • 2022-12-23
相关资源
相似解决方案