Skip to content

Instantly share code, notes, and snippets.

@mauris
Created August 12, 2012 16:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mauris/3332462 to your computer and use it in GitHub Desktop.
Save mauris/3332462 to your computer and use it in GitHub Desktop.
hash32shiftmult PHP port
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;
};
@mauris
Copy link
Author

mauris commented Aug 12, 2012

Note that regular collisions are observed from the integer 6990608 and onwards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment