- 自主仓 git.wxccs.org/EntitleForge/EntitleForge 拆分(协议实现单一归属: license/crypto/ulid 随 SDK 迁出,服务端反向依赖本仓) - sdk:Client 三模式(文件/远程/代理)、GRACE 状态机、查询 API(6.6ns/0 alloc) - license:三段式编解码与严格解析;crypto:Ed25519 信任链 + Proxy 受约束证书 - 零第三方依赖(CI 有依赖闭包断言红线);go.mod 零 require - CI:Gitea Actions(test + 零依赖断言 + 三平台交叉编译冒烟)
This commit is contained in:
32 files changed
+3940
No files matched your search
@@ -0,0 +1,19 @@
|
||||
package crypto
|
||||
|
||||
import (
|
||||
"crypto/sha256"
|
||||
"encoding/hex"
|
||||
"slices"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Fingerprint 计算机器指纹摘要(docs/design/04-crypto.md §5)。
|
||||
//
|
||||
// 输入为原始采集字段;输出 "sha256:" + hex,服务端与日志只见摘要。
|
||||
// 字段排序后拼接保证顺序无关(采集器返回顺序不稳定)。
|
||||
func Fingerprint(fields ...string) string {
|
||||
sorted := slices.Clone(fields)
|
||||
slices.Sort(sorted)
|
||||
sum := sha256.Sum256([]byte(strings.Join(sorted, " ")))
|
||||
return "sha256:" + hex.EncodeToString(sum[:])
|
||||
}
|
||||
Reference in new issue
Block a user