package iskra import "git.smesh.lol/iskradb/lattice" const ( fnvOffset64 uint64 = 14695981039346656037 fnvPrime64 uint64 = 1099511628211 ) // HashBytes computes 56-bit FNV-1a hash, discarding the top 8 bits. func HashBytes(data []byte) uint64 { h := fnvOffset64 for _, c := range data { h ^= uint64(c) h *= fnvPrime64 } return h >> 8 } // SegmentKey builds a 64-bit key for a segment at a given stage. func SegmentKey(stage uint8, content []byte) lattice.Key { return MakeCodeKey(stage, HashBytes(content)) }