hwBeta
首先引用这个命名空间
using System.Security.Cryptography;


//建立SHA1对象
SHA1 sha = new SHA1CryptoServiceProvider();
 

//将mystr转换成byte[]
ASCIIEncoding enc = new ASCIIEncoding();
byte[] dataToHash = enc.GetBytes(mystr);

//Hash运算
byte[] dataHashed = SHA1.ComputeHash(dataToHash );

//将运算结果转换成string
string hash = BitConverter.ToString(dataHashed).Replace("-", "");

return hash;

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2021-11-01
  • 2022-02-02
  • 2022-12-23
  • 2021-06-13
  • 2021-11-01
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-10-09
  • 2021-12-04
  • 2021-07-03
  • 2021-11-04
  • 2021-09-21
  • 2021-07-25
  • 2022-12-23
相关资源
相似解决方案