MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / computeCombinedHash

Function computeCombinedHash

internal/aiagentconfig/builder.go:178–186  ·  view source on GitHub ↗

computeCombinedHash sorts individual hashes, concatenates them, and hashes the result.

(hashes []string)

Source from the content-addressed store, hash-verified

176
177// computeCombinedHash sorts individual hashes, concatenates them, and hashes the result.
178func computeCombinedHash(hashes []string) string {
179 sorted := make([]string, len(hashes))
180 copy(sorted, hashes)
181 sort.Strings(sorted)
182
183 combined := sha256.Sum256([]byte(strings.Join(sorted, "")))
184
185 return hex.EncodeToString(combined[:])
186}
187
188// ensureInsideDir verifies that filePath is inside dir. Both paths must be
189// already resolved (no symlinks). Returns an error if the file escapes.

Callers 1

BuildFunction · 0.85

Calls 1

StringsMethod · 0.80

Tested by

no test coverage detected