Documentation
¶
Overview ¶
Package hashutil provides shared hash mixing constants and functions for probabilistic data structures (Count-Min Sketch, HyperLogLog, MinHash).
All functions use the splitmix64 finalizer by Vigna (2014) which provides full-avalanche mixing across all 64 bits.
Index ¶
Constants ¶
const ( // BaseSeed is the starting seed for deterministic seed generation. BaseSeed = 0x517cc1b727220a95 // MixShift1 is the first right-shift in the splitmix64 finalizer. MixShift1 = 30 // MixMul1 is the first multiplier in the splitmix64 finalizer. MixMul1 = 0xbf58476d1ce4e5b9 // MixShift2 is the second right-shift in the splitmix64 finalizer. MixShift2 = 27 // MixMul2 is the second multiplier in the splitmix64 finalizer. MixMul2 = 0x94d049bb133111eb // MixShift3 is the third right-shift in the splitmix64 finalizer. MixShift3 = 31 )
Splitmix64 constants from the splitmix64 finalizer by Vigna (2014).
Variables ¶
This section is empty.
Functions ¶
func GenerateSeeds ¶
GenerateSeeds creates n deterministic seeds using the given advance function. Use Mix64 for CMS-style seeds or Splitmix64 for MinHash-style seeds.
func Mix64 ¶
Mix64 applies the splitmix64 finalizer for full-avalanche mixing. This is a pure output function — it does NOT advance any state.
func MixHash ¶
MixHash combines a base hash with a seed using XOR and the splitmix64 finalizer. This produces a deterministic hash variation for a given (base, seed) pair.
func Splitmix64 ¶
Splitmix64 advances the state by the golden-ratio increment and applies the mix64 finalizer. This is a full PRNG step that both advances state and produces output.
Types ¶
This section is empty.