If the 64-bit hash is good, then selecting any 48 bits will also be a good hash. @Lee Daniel. Of course, information is lost and not reversible.
unsigned long long Mask48 = 0xFFFFFFFFFFFFu;
unsigned long long hash48 = hash64 & Mask48;
If 64-bit hash function is weak, then mod by the largest prime just under pow(2,48)
. Some buckets will be lost. This will not harm a good hash, yet certainly make weak hashes better.
unsigned long long LargestPrime48 = 281474976710597u; // FFFFFFFFFFC5
unsigned long long hash48 = hash64 % LargestPrime48;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…