From b57b3afb2c1ced7b8a75aa0c691b9015ec052d37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=B6=9B?= Date: Thu, 9 Oct 2025 11:21:17 +0800 Subject: [PATCH] =?UTF-8?q?fix(hash):=20=E4=BF=AE=E6=AD=A3=20BLAKE2B=20?= =?UTF-8?q?=E5=93=88=E5=B8=8C=E9=95=BF=E5=BA=A6=E9=85=8D=E7=BD=AE=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将 blake2b.New256 替换为 blake2b.New 并传入正确的字节长度参数 28, 以确保生成 224 位的哈希值。同时清理了文件末尾多余的空行。 --- hash/blake2b/blake2b.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hash/blake2b/blake2b.go b/hash/blake2b/blake2b.go index b1128f7..e6adbb0 100644 --- a/hash/blake2b/blake2b.go +++ b/hash/blake2b/blake2b.go @@ -15,7 +15,7 @@ import ( func hasherSelect(bitSize int) hash.Hash { switch bitSize { case 224: - hasher, _ := blake2b.New256(nil) + hasher, _ := blake2b.New(28, nil) return hasher case 256: hasher, _ := blake2b.New256(nil) @@ -114,4 +114,4 @@ func SumFileHex(file string, bitSize ...int) (string, error) { return "", err } return hex.EncodeToString(hash), nil -} \ No newline at end of file +}