asp.net中的MD5加密
生活随笔
收集整理的這篇文章主要介紹了
asp.net中的MD5加密
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
其實(shí)在ASP.Net編程中,不用調(diào)用md5.asp來加密數(shù)據(jù)。在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";
}
轉(zhuǎn)載于:https://www.cnblogs.com/51hits/archive/2007/11/22/968792.html
與50位技術(shù)專家面對(duì)面20年技術(shù)見證,附贈(zèng)技術(shù)全景圖總結(jié)
以上是生活随笔為你收集整理的asp.net中的MD5加密的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: .NET设计模式(5):工厂方法模式(F
- 下一篇: Windows系统中让硬盘更快的九大绝招