论坛
门户
内部优惠
喜欢
话题
VIP会员
搜索
新浪微博
登录
注册
100%
100%
首页
>
网页设计
>
net技术
>
用 ASP.Net 中的自带类进行MD5加密
回复
« 返回列表
schack8888
风云使者
注册日期
2010-12-06
发帖数
686
QQ
火币
3641枚
粉丝
161
关注
102
加关注
写私信
打招呼
阅读:
4733
回复:
0
用 ASP.Net 中的自带类进行MD5加密
楼主
#
更多
只看楼主
倒序阅读
发布于:2011-08-16 12:39
保存
100%
100%
[]
1
其实在ASP.Net编程中,不用调用md5.asp来加密数据。在DotNet中有自带的类:System.
web
.Security.HashPasswordForStoringInConfigFile()
[color=#990000;]以下是引用片段:
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";
}
喜欢
0
评分
0
最新喜欢:
兼职版主
回复
100%
发帖
回复
« 返回列表
普通帖
您需要登录后才可以回帖,
登录
或者
注册
100%
返回顶部
关闭
最新喜欢