1、
cmd : certutil -hashfile 文件path
2、代码的方式
using System;
using System.IO;
using System.Text;
using UnityEngine;
using System.Security.Cryptography;
public class MD5Test: MonoBehaviour
{
private StringBuilder _stringBuilder;
private void Start()
{
_stringBuilder = new StringBuilder();
try
{
// 找到指定文件
var fs = new FileStream(Application.streamingAssetsPath + "/AssetBundles/pannel", FileMode.Open);
MD5 md5 = new MD5CryptoServiceProvider();
var retVal = md5.ComputeHash(fs);
fs.Close();
foreach (var t in retVal)
{
_stringBuilder.Append(t.ToString("X"));
}
Log.Debug(_stringBuilder);
}
catch (Exception ex)
{
throw new Exception("Get File MD5 Fail, error:" + ex.Message);
}
}
}