MCPcopy Create free account
hub / github.com/cortexproject/cortex / HashAdd32

Function HashAdd32

pkg/ingester/client/fnv.go:55–61  ·  view source on GitHub ↗

HashAdd32 adds a string to a fnv32 hash value, returning the updated hash. Note this is the same algorithm as Go stdlib `sum32.Write()`

(h uint32, s string)

Source from the content-addressed store, hash-verified

53// HashAdd32 adds a string to a fnv32 hash value, returning the updated hash.
54// Note this is the same algorithm as Go stdlib `sum32.Write()`
55func HashAdd32(h uint32, s string) uint32 {
56 for i := 0; i < len(s); i++ {
57 h *= prime32
58 h ^= uint32(s[i])
59 }
60 return h
61}
62
63// HashAddByte32 adds a byte to a fnv32 hash value, returning the updated hash.
64func HashAddByte32(h uint32, b byte) uint32 {

Callers 1

compactionLoopMethod · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected