标签:
private static string tottt(string s) { byte[] source = md5.ComputeHash(Encoding.UTF8.GetBytes(s)); StringBuilder sBuilder = new StringBuilder(); for (int i = 0; i < source.Length; i++) { sBuilder.Append(source[i].ToString("x2")); } return sBuilder.ToString(); } private static string tottt2(string s) { byte[] source = md52.ComputeHash(Encoding.UTF8.GetBytes(s)); StringBuilder sBuilder = new StringBuilder(); for (int i = 0; i < source.Length; i++) { sBuilder.Append(source[i].ToString("x2")); } return sBuilder.ToString(); } private static string tottt3(string s) { return System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(s, "MD5").ToLower(); }
测试在使用Encoding.UTF8时,三个方法计算结果是一致的
标签:
原文地址:http://www.cnblogs.com/wj033/p/5234684.html