RSS
热门关键字:  数据挖掘  人工智能  数据仓库  搜索引擎  数据挖掘导论
当前位置 :| 首页>编程技术>asp.net编程>

Net2005中的MD5加密

来源: 作者: 时间:2007-01-27 点击:

其实在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";
  } 数据挖掘研究院

最新评论共有 0 位网友发表了评论
发表评论
评论内容:不能超过250字,需审核,请自觉遵守互联网相关政策法规。
匿名?