技巧应用:ASP.Net中的MD5加密
点击次数:36 次 发布日期:2008-11-21 22:23:57 作者:源代码网
|
源代码网推荐源代码网整理以下其实在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"; }
|
源代码网供稿. |