1
0
mirror of https://github.com/fumiama/WireGold.git synced 2026-06-12 21:00:27 +08:00

feat(head): use uniform head extract & crc64 -> md5

This commit is contained in:
源文雨
2024-08-08 12:42:04 +08:00
parent e018aee705
commit d5d7a9412f
5 changed files with 63 additions and 39 deletions

View File

@@ -40,7 +40,7 @@ func (m *Me) wait(data []byte) *head.Packet {
}
return nil
}
crc := binary.LittleEndian.Uint64(data[52:head.PacketHeadLen])
crc := head.CRC64(data)
crclog := crc
crc ^= (uint64(seq) << 16)
if config.ShowDebugLog {
@@ -67,7 +67,7 @@ func (m *Me) wait(data []byte) *head.Packet {
}
crchash := crc64.New(crc64.MakeTable(crc64.ISO))
_, _ = crchash.Write(data[20:52])
_, _ = crchash.Write(head.Hash(data))
var buf [4]byte
binary.LittleEndian.PutUint32(buf[:], seq)
_, _ = crchash.Write(buf[:])