返回 DeepSeek-Reasonix
hash.go
根目录 / internal / bot / hash.go
1 package bot
2
3 import (
4 "crypto/sha256"
5 "encoding/hex"
6 )
7
8 // hashID 对用户/群聊 ID 做脱敏哈希,用于日志和状态展示。
9 func hashID(id string) string {
10 if id == "" {
11 return ""
12 }
13 h := sha256.Sum256([]byte(id))
14 return hex.EncodeToString(h[:])[:12]
15 }
16
16 lines GO