Add deterministic file ordering in Builder.Build() (closes #23) #28

Open
clawbot wants to merge 3 commits from fix/issue-23 into next
2 changed files with 5 additions and 4 deletions
Showing only changes of commit 85fc39cace - Show all commits

View File

@ -156,7 +156,7 @@ func (mfa *CLIApp) run(args []string) {
},
&cli.StringFlag{
Name: "seed",
Usage: "Seed value for deterministic manifest UUID (hashed 1B times with SHA-256)",
Usage: "Seed value for deterministic manifest UUID (hashed 150M times with SHA-256, ~5-10s)",
EnvVars: []string{"MFER_SEED"},
},
),

View File

@ -93,11 +93,12 @@ type Builder struct {
}
// seedIterations is the number of SHA-256 rounds used to derive a UUID from a seed.
const seedIterations = 1_000_000_000
// Tuned to take approximately 5-10 seconds on modern hardware.
const seedIterations = 150_000_000
// SetSeed derives a deterministic UUID from the given seed string.
// The seed is hashed 1,000,000,000 times with SHA-256 to produce
// 16 bytes used as a fixed UUID for the manifest.
// The seed is hashed 150,000,000 times with SHA-256 to produce
// 16 bytes used as a fixed UUID for the manifest (~5-10s on modern hardware).
func (b *Builder) SetSeed(seed string) {
b.fixedUUID = deriveSeedUUID(seed, seedIterations)
}