MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / ComputeExcludedModelsHash

Function ComputeExcludedModelsHash

internal/watcher/diff/model_hash.go:91–108  ·  view source on GitHub ↗

ComputeExcludedModelsHash returns a normalized hash for excluded model lists.

(excluded []string)

Source from the content-addressed store, hash-verified

89
90// ComputeExcludedModelsHash returns a normalized hash for excluded model lists.
91func ComputeExcludedModelsHash(excluded []string) string {
92 if len(excluded) == 0 {
93 return ""
94 }
95 normalized := make([]string, 0, len(excluded))
96 for _, entry := range excluded {
97 if trimmed := strings.TrimSpace(entry); trimmed != "" {
98 normalized = append(normalized, strings.ToLower(trimmed))
99 }
100 }
101 if len(normalized) == 0 {
102 return ""
103 }
104 sort.Strings(normalized)
105 data, _ := json.Marshal(normalized)
106 sum := sha256.Sum256(data)
107 return hex.EncodeToString(sum[:])
108}
109
110func normalizeModelPairs(collect func(out func(key string))) []string {
111 seen := make(map[string]struct{})

Calls

no outgoing calls