📄 md5helper.cs
字号:
namespace Imps.Client.Utils.Cryptography
{
using Imps.Client.Utils;
using System;
using System.IO;
using System.Security.Cryptography;
public class MD5Helper
{
public static string GetFileMD5(string filePath)
{
string text;
if (string.IsNullOrEmpty(filePath))
{
throw new ArgumentNullException("filePath");
}
using (FileStream inputStream = new FileStream(filePath, FileMode.Open, FileAccess.Read))
{
MD5 md = null;
try
{
md = new MD5CryptoServiceProvider();
md.Initialize();
text = ComputeAuthResponse.BinaryToHex(md.ComputeHash(inputStream));
}
finally
{
if (md != null)
{
md.Clear();
}
}
}
return text;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -