Sign in to PrePAN

Digest::xxH64 Perl interface implementation to xxHash 64 bit algorithm



# Object oriented style interface

use Digest::xxH64;

my $xx = Digest::xxH64->new;

$xx->add($data1, $data2, $data3);
$xx->addfile($another_file_hadle, $read_length);

my $hash64 = $xx->digest();
my $hash64_hex = $xx->hexdigest();
my $hash64_bin = $xx->bindigest();

my $another_hash64 = $xx->digest();
my $another_hash64_hex = $xx->hexdigest();
my $another_hash64_bin = $xx->bindigest();

# Functional style interface

use Digest::xxH64 qw( xxHash64 xxHash64hex xxHash64bin xx64 xx64hex xx64bin xxH64 xxH64hex xxH64bin );

my $hash64 = xxHash64($data);
my $hash64_hex = xxHash64hex($data);
my $hash64_bin = xxHash64bin($data);

my $hash64 = xx64($data);
my $hash64_hex = xx64hex($data);
my $hash64_bin = xx64bin($data);

my $hash64 = xxHash64($data, $seed);
my $hash64_hex = xxHash64hex($data, $seed);
my $hash64_bin = xxHash64bin($data, $seed);


xxHash is an extremely fast non-cryptographic hash algorithm, working at speeds close to RAM limits. It is proposed in two flavors, 32 and 64 bits, producing 32 bit or 64 bit long digest output, respectively. (See for details) This module is an object oriented interface of xxHash 64-bit hash functions. The interface implementation can handle data of arbitrary length and capable to run both on 32 bit and 64 bit Perl environment.


Please sign up to post a review.