其實在ASP.Net程式設計中,不用呼叫md5.asp來加密資料。在DotNet中有自帶的類別:System.Web.Security.HashPasswordForStoringInConfigFile()
public string md5(string str,int code)
{
if(code==16) //16位元MD5加密(取32位元加密的9~25字元)
{
return System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(str,"MD5").ToLower().Substring(8,16) ;
}
if(code==32) //32位元加密
{
return System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(str,"MD5").ToLower();
}
return "00000000000000000000000000000000";
}