當前位置:
首頁 >
asp.net中的MD5加密
發布時間:2025/1/21
90
豆豆
生活随笔
收集整理的這篇文章主要介紹了
asp.net中的MD5加密
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
其實在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";
}
轉載于:https://www.cnblogs.com/51hits/archive/2007/11/22/968792.html
與50位技術專家面對面20年技術見證,附贈技術全景圖總結
以上是生活随笔為你收集整理的asp.net中的MD5加密的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: .NET设计模式(5):工厂方法模式(F
- 下一篇: [转][.NET 基于角色安全性验证]