1
0
mirror of https://github.com/fumiama/WireGold.git synced 2026-06-09 02:02:41 +08:00

fix: multi-segment hash checking

This commit is contained in:
源文雨
2025-04-03 00:00:21 +09:00
parent 6fc45333d8
commit 0c2f201bd0
15 changed files with 227 additions and 209 deletions

View File

@@ -5,6 +5,7 @@ import (
"crypto/md5"
"encoding/binary"
"encoding/hex"
"fmt"
"github.com/fumiama/WireGold/config"
"github.com/fumiama/blake2b-simd"
@@ -20,7 +21,7 @@ func Blake2bHash8(precrc64 uint64, data []byte) uint64 {
_, _ = h.Write(data)
b := h.Sum(tgt[:0])[:8]
if config.ShowDebugLog {
logrus.Debugln("[algo] blk2b hash:", hex.EncodeToString(b))
logrus.Debugln("[algo] precrc64:", fmt.Sprintf("%04x", precrc64), "blk2b hash:", hex.EncodeToString(b))
}
return binary.LittleEndian.Uint64(b)
}