computeCombinedHash sorts individual hashes, concatenates them, and hashes the result.
(hashes []string)
| 176 | |
| 177 | // computeCombinedHash sorts individual hashes, concatenates them, and hashes the result. |
| 178 | func 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. |