Created
August 12, 2012 16:02
-
-
Save mauris/3332462 to your computer and use it in GitHub Desktop.
hash32shiftmult PHP port
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function hash32shiftmult($key){ | |
$seed = 0x27d4eb2d; // a prime or an odd constant | |
$key = ($key ^ 61) ^ ($key >> 16); | |
$key = $key + ($key << 3); | |
$key = $key ^ ($key >> 4); | |
$key *= $seed; | |
$key = $key ^ ($key >> 15); | |
return $key; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note that regular collisions are observed from the integer 6990608 and onwards.