public static void MD5() { string key = "1c7d2ad19e9176c555b6149f3c8f1f0f#678b227765944e3413de1e017a5d5c2f"; byte[] bytes = Encoding.GetEncoding("UTF-8").GetBytes(key); string result = EncryptUtil.Bytes2MD5(bytes); Debugger.Log(result.Length.ToString()); Debugger.Log(result.ToLower()); }
private bool CheckedMD5(string fileName, string md5Value, out bool isUnExist) { //#if UNITY_EDITOR // return false; //#endif isUnExist = false; bool result = false; if (string.IsNullOrEmpty(fileName) || string.IsNullOrEmpty(md5Value)) { isUnExist = true; return(result); } string path = targetDir + "/" + fileName; string localPath = string.Empty; if (!ResUtil.ExistsInLocal(path, out localPath)) { isUnExist = true; return(result); } try { byte[] bytes = File.ReadAllBytes(localPath); string encodeMD5 = EncryptUtil.Bytes2MD5(bytes); result = md5Value.Equals(encodeMD5); //result = true; if (!result) { Debugger.Log(string.Format("file {0}被修改了", fileName)); } } catch (Exception e) { Debugger.LogError(e.StackTrace); } return(result); }