Re:XXH3 – a new speed-optimized hash algorithm
by dragontamer on Friday March 15, 2019 @06:33PM
(#19404939)
> 0xAAAAAAA5 instead of 0xAAAAAAAA or 0xA5A5A5A5?
0xAAAAAAAA isn't odd. Every time you multiply with 0xAAAAAAAA, you lose the top-most bit of your state (alternatively: the bottom-most bit will ALWAYS be zero. So you lost a bit). If you start with 32-bits of entropy, multiplying with 0xAAAAAAAA results with 31-bits of entropy.
> 0xA5A5A5A5
That's where statistical tests need to come into the picture, to differentiate. I've written GPGPU programs to brute-force search for constants based on a few metrics.
In these brute-force searches, even a simple number like 0xAAAAAAA5 works out decently. Its suboptimal in my experience, but its surprisingly "not bad". My only point is that you shouldn't limit your search to prime numbers. Any odd number works pretty decently as a multiplication constant.
Any reason why use use 0xAAAAAAA5 instead of 0xAAAAAAAA or 0xA5A5A5A5?