c# 计算md5哈希字符串
public static string calculatemd5hash(string input)
{
// step 1, calculate md5 hash from input
var md5 = md5.create();
byte[] inputbytes = encoding.ascii.getbytes(input);
byte[] hash = md5.computehash(inputbytes);
// step 2, convert byte array to hex string
var sb = new stringbuilder();
for (int i = 0; i < hash.length; i++)
{
sb.append(hash[i].tostring("x2"));
}
return sb.tostring();
}
以上就是c# 计算md5哈希字符串的内容。