
.NET framework 4
using System.Security.Cryptography;
public static string GetFileHash(string pFileName)
{
string retValue = string.Empty;
using (FileStream fs = File.OpenRead(pFileName))
{
MD5 sscMD5 = MD5.Create();
byte[] mHash = sscMD5.ComputeHash(fs);
retValue = Convert.ToBase64String(mHash);
}
return retValue;
}
|
