-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Took some work, but I implement mzHash64 in pure Perl.
sub mzhash64 {
my ($input, $seed) = @_;
$seed ||= 0;
my $hash = (16327758955582512922 ^ $seed);
use bytes;
for (my $i = 0; $i < length($input); $i++) {
my $char = substr($input, $i, 1);
use integer;
my $chunk1 = (12889002000335424835 * ($i + ord($char)));
no integer;
my $chunk2 = ($hash << 2) ^ ($hash >> 2);
$hash = $chunk1 ^ $chunk2;
}
no bytes;
return $hash;
}
Metadata
Metadata
Assignees
Labels
No labels