标签:style blog color os io for div ar
/// <summary> /// Web 转换MD5 /// </summary> /// <param name="str">字符</param> /// <param name="code">32或64位</param> /// <returns></returns> public static string MD5(string str, int
//MD5 正常加密 public static string HashString(string str) { MD5 md5=MD5.Create(); byte[] source = md5.ComputeHash(Encoding.Default.GetBytes(str)); StringBuilder sb = new StringBuilder(); for (int i = 0; i < source.Length; i++) { sb.Append(source[i].ToString("x")); } return sb.ToString(); }
) { if (code == 16) { return System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(str, "MD5").ToLower().Substring(8, 16); } if (code == 32) { return System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(str, "MD5"); } return "00000000000000000000000000000000"; }
标签:style blog color os io for div ar
原文地址:http://www.cnblogs.com/Evaniko/p/3872593.html