C# MD5 加密方法

 1public string md5(string str,int code) 
 2
 3    if(code==16//16位MD5加密(取32位加密的9~25字符) 
 4    
 5        return System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(str,"MD5").ToLower().Substring(8,16) ; 
 6    }
  
 7    else//32位加密 
 8    
 9        return System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(str,"MD5").ToLower(); 
10    }
  
11}
 
12
posted @ 2006-06-29 12:00  wenanry  阅读(3543)  评论(0编辑  收藏  举报