JavaScrip Zone


新发表

新评论

留言信息

链接收藏

『中国群落博客』

免费注册博客通道

快速登陆


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";
}

 


                                                                 2008-7-8 12:05:48

Posted by jser | 阅读全文() | 回复(0) | 引用通告() | 编辑

..................................................
博客的精神于写自己某一刻的思想或心动!
..................................................
当然要是你愿意就是拿来做记事本也可以!
..................................................
群落博客将提供全程免费服务!免费注册!
..................................................
欢迎您成为群落博客的成员!使用之前请先看系统帮助>>>>系统帮助
..................................................

免费注册群落博客【点击完成注册】
..................................................

发表评论:

    昵称:
    密码: (游客无须输入密码)
    主页:
    标题: