Digest::SipHash::PP - Pure-Perl implementation of the SipHash algorithm
$Id: PP.pm,v 0.12 2013/02/28 03:18:03 dankogai Exp $
use Digest::SipHash::PP qw/siphash/; my $seed = pack 'C16', 0 .. 0xF; # 16 chars long my $str = "hello world!"; my ( $lo, $hi ) = siphash( $str, $seed ); # $lo = 0x10cf32e0, $hi == 0x7da9cd17 my $u32 = siphash( $str, $seed ) # $u32 = 0x10cf32e0 use Config; if ( $Config{use64bitint} ) { use Digest::SipHash qw/siphash64/; my $uint64 = siphash64( $str, $seed ); # scalar context; # $uint64 == 0x7da9cd1710cf32e0 }
This module is identical to Digest::SipHash except implementation. This module is not meant to be practical; written just for the sake of curiosity.
For the sake of 32-bit compatibility, this module uses Math::BigInt for 64-bit operations on which SipHash heavily relies.
siphash()
, siphash32()
and siphash64()
on demand.
:all
to all of above
See Digest::SipHash for details.
Dan Kogai, <dankogai+cpan at gmail.com>
Copyright 2013 Dan Kogai.
This program is free software; you can redistribute it and/or modify it under the terms of the the Artistic License (2.0). You may obtain a copy of the full license at: