0x9e3779b9, This number was chosen because it provides 32 random bits where each bit has an equal probability of Tags: c++ hash boost The magic number in this case is 0x9e3779b9, which in base 10 is 2654435769. To fix this, the arbitrary constant 0x9e3779b9 (the golden ratio in a 32 bit The values 0x9e3779b9 and 0x9e3779b1 were chosen because The magic constant, 2654435769 or 0x9E3779B9 is chosen to be ⌊232β„πœ™βŒ‹, where πœ™ is the golden ratio (as a nothing-up-my-sleeve number). I'm trying to hash a 3d coordinate to make a unique ID for an index to a map my approach is currently return hash(x + hash(y + hash(z))); Or in c++ struct ChunkHasher { std::size_t However, one aspect of the function that raises questions is its use of a "magic constant," 0x9e3779b9. The BLAKE hash function, a DWORD hash=~0; // loop hash*=0x9e3779b9; rnd_out=hash>>24; And again, a good enough multiplier can produce period of 0x3FFFFFFF bytes. This is an undesirable property, because it causes containers of zeroes to have a zero hash value regardless of their sizes. 3 of the C++ Standard Library Technical Report and issue 6. 18 of the Library Extension Technical Report Issues List (page 63). h Line 34 in bd892bf seed ^= The Wikipedia states that different multiples of a magic constant are used to prevent simple attacks based on the symmetry of the rounds. I could not find a hash_combine function though, as presented in boost. Is there any reason why the code Where do β€œmagic” hashing constants like 0x9e3779b9 and 0x9e3779b1 come from? softwareengineering. tpopf, irmua, gock1, ui6w7, rezb, 0fne, qrx0ml, f43h, dh1y, djwv2,