用C#做windows程序,想做个信息摘要,
使用了c#中的MD5,HMACMD5产生的hashcode虽然是128位,但我比较以前的程序(其它语言)产生的值不一致,
c#中产生的这个哈希值,不是MD5信息摘要?是个哈希散列值吧
c#中用什么方法产生MD5信息摘要呢?
使用了c#中的MD5,HMACMD5产生的hashcode虽然是128位,但我比较以前的程序(其它语言)产生的值不一致,
c#中产生的这个哈希值,不是MD5信息摘要?是个哈希散列值吧
c#中用什么方法产生MD5信息摘要呢?
{
FileStream fs = new FileStream(path,FileMode.Open,FileAccess.Read);
MD5CryptoServiceProvider MD5 = new MD5CryptoServiceProvider();
byte[] md5byte = MD5.ComputeHash(fs);
int i, j;
string str="";
foreach (byte b in md5byte)
{
i=Convert.ToInt32(b);
j=i>>4;
System.Diagnostics.Debug.WriteLine(j.ToString());
str += Convert.ToString(j, 16);
System.Diagnostics.Debug.WriteLine(i.ToString());
j = i & 15;
str += Convert.ToString(j, 16);
System.Diagnostics.Debug.WriteLine(j.ToString());
}
fs.Close();
return str;
}
计算文件的md5值
我要签名的是个字节数组,
MD5CryptoServiceProvider 没指定密钥,而且我觉得这个哈希值不是信息摘要
但我就是想C#中的MD5,HMACMD5产生的是个什么样的信息摘要,应该和哈希有些关系。
请路过的发表一下看法