using System.Security.Cryptography;
using System.Text;//……public static string getFileHash(string filePath)
{
FileStream fs = new FileStream(filePath, FileMode.Open);
MD5 md5 = new MD5CryptoServiceProvider();
byte[] result = md5.ComputeHash(fs);
string sResult = "";
foreach(byte b in result)
{
sResult += Convert.ToString(b,16);
}
fs.Close();
return sResult;
}
http://community.csdn.net/Expert/topic/5678/5678235.xml?temp=.1412012
using System.Text;//……public static string getFileHash(string filePath)
{
FileStream fs = new FileStream(filePath, FileMode.Open);
MD5 md5 = new MD5CryptoServiceProvider();
byte[] result = md5.ComputeHash(fs);
string sResult = "";
foreach(byte b in result)
{
sResult += Convert.ToString(b,16);
}
fs.Close();
return sResult;
}
http://community.csdn.net/Expert/topic/5678/5678235.xml?temp=.1412012
但是就是有很多网站用的加密方式是不正规的~
就是下面那种算法:
string s = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(strPsswd, "MD5")
但是到2005就行不通了!!!!诶~~