| Utility/FileExtersion.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
Utility/FileExtersion.cs
@@ -155,4 +155,24 @@ throw new Exception("GetMD5HashFromFile() fail,error:" + ex.Message); } } public static string GetStringMD5Hash(string str) { try { var bytes = Encoding.UTF8.GetBytes(str); var md5 = new MD5CryptoServiceProvider(); var retVal = md5.ComputeHash(bytes); var sb = new StringBuilder(); for (int i = 0; i < retVal.Length; i++) { sb.Append(retVal[i].ToString("x2")); } return sb.ToString(); } catch (Exception ex) { throw new Exception("GetMD5HashFromFile() fail,error:" + ex.Message); } } }