欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

asp.net中MD5 16位和32位加密函数

程序员文章站 2022-07-19 16:51:07
public string md5(string str,int code)   {   &...
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) ;
   } 
   else//32位加密
   {
    return system.web.security.formsauthentication.hashpasswordforstoringinconfigfile(str,"md5").tolower();
   } 
  }