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