NAME
Digest::xxHash64 - Calculate both 32 and 64-bit xxHash values from Perl
SYNOPSIS
use Digest::xxHash64 qw(xxhash32 xxhash32_hex xxhash64 xxhash64_hex);
my $content = join '', 'a' .. 'z';
my $hash32 = xxhash32( $content, 0 );
my $hex32 = xxhash32_hex( $content, 0 );
my $hash64 = xxhash64( $content, 0 );
my $hex64 = xxhash64_hex( $content, 0 );
DESCRIPTION
xxHash is an Extremely fast Hash algorithm, running at RAM speed limits. It successfully completes the SMHasher test suite which evaluates collision, dispersion and randomness qualities of hash functions. See the official repository for more information.
FUNCTION INTERFACE
Nothing is exported by default.
xxhash32($input, $seed)
-
Returns the 32-bit hash of
$input
using 32-bit seed$seed
. - xxhash32_hex
-
Returns an 8-digit hexadecimal string containing the 32-bit hash in network (big endian) order. This is what the command line utility
xxh32sum
reports. - xxhash64
-
Returns the 64-bit hash of
$input
using 64-bit seed$seed
.Currently, if your Perl doesn't natively support 64-bit integers, this is not going to be accurate. You should still be able to use
xxhash64_hex
. However, I have not tested this. - xxhash64_hex
-
Returns a 16-digit hexadecimal string containing the 64-bit hash in network (big endian) order. This is what the command line utility
xxh64sum
reports.
SEE ALSO
AUTHOR
A. Sinan Unur <nanis@cpan.org>
COPYRIGHT
Copyright (C) 2015 by A. Sinan Unur
LICENSE
The MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.