From 7f70c2e7f70cab4f6653211b6a9904c73ea2a33c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=BE=99=E8=85=BE=E7=8C=AB=E8=B7=83?= <1043137532@qq.com>
Date: Thu, 21 May 2026 00:38:29 +0800
Subject: [PATCH] *
---
Shared/Utils/CryptographyUtils.cs | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/Shared/Utils/CryptographyUtils.cs b/Shared/Utils/CryptographyUtils.cs
index 074ff4d..6d118a4 100644
--- a/Shared/Utils/CryptographyUtils.cs
+++ b/Shared/Utils/CryptographyUtils.cs
@@ -35,7 +35,7 @@ public static class CryptographyUtils {
///
/// 计算文件的 Hash。返回 16 进制小写字符串。
///
- public static string ComputeFileHash(string filePath, HashMethod method) {
+ public static string ComputeFileHash(string filePath, HashMethod method = HashMethod.Md5) {
using HashAlgorithm hashImpl = GetHashAlgorithm(method);
Logger.Trace($"计算文件 {method}:{filePath}");
using var file = FileUtils.ReadAsStream(filePath);
@@ -45,7 +45,7 @@ public static class CryptographyUtils {
///
/// 计算字节数组的 Hash。返回 16 进制小写字符串。
///
- public static string ComputeHash(byte[] input, HashMethod method) {
+ public static string ComputeHash(byte[] input, HashMethod method = HashMethod.Md5) {
using HashAlgorithm hashImpl = GetHashAlgorithm(method);
return BitConverter.ToString(hashImpl.ComputeHash(input)).Replace("-", "").Lower();
}
@@ -53,7 +53,7 @@ public static class CryptographyUtils {
/// 计算字符串的 Hash。返回 16 进制小写字符串。
/// 使用 UTF-8 将字符串转换为字节数组。
///
- public static string ComputeHash(string input, HashMethod method)
+ public static string ComputeHash(string input, HashMethod method = HashMethod.Md5)
=> ComputeHash(Encoding.UTF8.GetBytes(input), method);
#endregion