namespace NFine.Code { /// /// MD5加密 /// public class Md5 { /// /// MD5加密 /// /// 加密字符 /// 加密位数16/32 /// public static string md5(string str, int code) { string strEncrypt = string.Empty; if (code == 16) { strEncrypt = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(str, "MD5").Substring(8, 16); } if (code == 32) { strEncrypt = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(str, "MD5"); } return strEncrypt; } } }