MD5加密,生成32为纯字符串,需要引用一下两个命名空间
using System.Security.Cryptography;
using System.Text;
public string md5(string str)
{
MD5 m = new MD5CryptoServiceProvider();
byte[] s =m.ComputeHash(UnicodeEncoding.UTF8.GetBytes(str));
return BitConverter.ToString(s).Replace("-",""); //移除“-”
}