Daisuke Maki > Digest-MurmurHash3 > Digest::MurmurHash3

Download:
Digest-MurmurHash3-0.03.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Module Version: 0.03   Source  

NAME ^

Digest::MurmurHash3 - MurmurHash3 Implementation For Perl

SYNOPSIS ^

    use Digest::MurmurHash3 qw( murmur32 );

    # on 64 bit platforms, defaults to x64. otherwise x86
    # note that the values for each platform *WILL DIFFER*
    use Digest::MurmurHash3 qw( murmur128 );

    # If you want to explicitly require one algorithm, you need
    # to be specific
    use Digest::MurmurHash3 qw( murmur128_x64 );
    use Digest::MurmurHash3 qw( murmur128_x86 );

    my $hash = murmur32( $data_to_hash );

    # Create four 8 bit pieces
    my ($v1, $v2, $v3, $v4) = murmur128_x86( $data_to_hash );

    # Create two 64 bit pieces (your perl must be built to use 64bit ints)
    my ($v1, $v2) = murmur128_x64( $data_to_hash );

DESCRIPTION ^

This module provides an interface to MurmurHash3 functions.

FUNCTIONS ^

$h = murmur32( $data [, $seed] )

Calculates a 32 bit hash.

@varies = murmur128( $data [, $seed ] )

Calculates a 128 bit hash.

Note that the actual implementation of this function will differ depending on how your perl was built.

If your perl was built with 64 bit integers, this function is an alias to mumur128_x64(). Otherwise, it's an alias to mumur128_x68(). While they employ similar calculations, each use the best approach for your system so the results are different. The x64 version returns two element list of 64 bit integers. The x86 version returns a four element list of 32 bit integers.

($v1, $v2, $v3, $v4) = mumur128_x86( $data [, $seed ] )

Calculates a 128 bit hash. The result is returned as a four element list of 32 bit integers

($v1, $v2) = murmur128_x64( $data [, $seed ] )

Calculates a 128 bit hash. The result is returned as a two element list of 64 bit integers

AUTHOR ^

Daisuke Maki <daisuke@endeworks.jp>

MurmurHash3 by Austin Appleby.

syntax highlighting: