github.com/grafana/pyroscope@v1.18.0/pkg/util/fnv32/fnv32.go (about) 1 package fnv32 2 3 // Inline and byte-free variant of hash/fnv's fnv64a. 4 const ( 5 offset32 = 2166136261 6 prime32 = 16777619 7 ) 8 9 // New initializies a new fnv32 hash value. 10 func New() uint32 { 11 return offset32 12 } 13 14 // AddByte32 adds a byte to a fnv32 hash value, returning the updated hash. 15 func AddByte32(h uint32, b byte) uint32 { 16 h *= prime32 17 h ^= uint32(b) 18 return h 19 }