通过本文主要向大家介绍了md5字符串,md5加密字符串,md5验证字符串,java md5加密字符串,字符串转md5等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
//计算文件的MD5值
public string MD5Value(String filepath)
{
MD5 md5 = new MD5CryptoServiceProvider();
byte[] md5ch;
using (FileStream fs = File.OpenRead(filepath))
{
md5ch = md5.ComputeHash(fs);
}
md5.Clear();
string strMd5 = "";
for (int i = 0; i < md5ch.Length - 1; i++)
{
strMd5 += md5ch[i].ToString("x").PadLeft(2, '0');
}
return strMd5;
}
</div>