Digest-JHash-0.09000755000764000764 012532311510 14142 5ustar00shlomifshlomif000000000000README100644000764000764 130712532311510 15104 0ustar00shlomifshlomif000000000000Digest-JHash-0.09Digest/JHash version 0.03 ========================= INSTALLATION To install this module type the following (nmake on Win32): perl Makefile.PL make make test make install DEPENDENCIES None MORE DETAILS Read the POD in JHash.xs or the HTML version of that POD in html/JHash.html COPYLEFT AND UN-LICENCE This module is free software and is provided in the hope that it may prove useful. All care but no responsibility or liability. Use at own risk. May cause cancer if used excessively. Then again it may not. R&D (Rip-off and Duplicate) as desired. Feel free to remove this copyright and call it your own if that makes you happy. Copyright (C) 2003-2008 Andrew Towers and James Freeman. Changes100644000764000764 306412532311510 15521 0ustar00shlomifshlomif000000000000Digest-JHash-0.09Revision history for Perl extension Digest::JHash. 0.09 2015-05-30 - Convert to Dist-Zilla. - This implies several enhancements including links to the VCS repositories in META.yml/META.json. 0.08 2014-01-27 - Add a minimal version on perl-5.8.0. - For CPANTS Kwalitee. - Add t/cpan-changes.t - Add a LICENSE file (for CPANTS Kwalitee). 0.07 2010-09-04 - Got rid of the SIGNATURE file which was out-of-date. - https://rt.cpan.org/Ticket/Display.html?id=61053 0.06 2010-07-26 - Reuploading to get rid of the world-writable files and directories in the archive. 0.05 2008-06-06 - Patched to make algorithm compatible with unwanted 64 bit int in U32 0.04 2008-06-04 - Moved developer only tests kwalitee.t and spelling.t to misc/ to stop kwalitee from demanding they be listed as build pre-reqs in META.yml 0.03 2008-06-04 - Repackaged into Kwalitee compliant package 0.02 2003-04-07 - Changed untar dir structure to standard one - Modified JHash.pm @EXPORT_OK so jhash() function can be exported on demand - A small clean up to handle undef and null string input cases - Added tests for the undef and null string input cases - finished POD - Added speed note to pod and demo script to misc/oo_vs_func.pl - Added DEBUG const to C code for conveneience and to conform with coding conventions of PHB - Cleaned up Makefile.PL to minimal case 0.01 2003-04-06 - original version; created by h2xs 1.21 with options -An Digest::JHash LICENSE100644000764000764 2142312532311510 15252 0ustar00shlomifshlomif000000000000Digest-JHash-0.09This is free software, licensed under: The Artistic License 2.0 (GPL Compatible) The Artistic License 2.0 Copyright (c) 2000-2006, The Perl Foundation. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble This license establishes the terms under which a given free software Package may be copied, modified, distributed, and/or redistributed. The intent is that the Copyright Holder maintains some artistic control over the development of that Package while still keeping the Package available as open source and free software. You are always permitted to make arrangements wholly outside of this license directly with the Copyright Holder of a given Package. If the terms of this license do not permit the full use that you propose to make of the Package, you should contact the Copyright Holder and seek a different licensing arrangement. Definitions "Copyright Holder" means the individual(s) or organization(s) named in the copyright notice for the entire Package. "Contributor" means any party that has contributed code or other material to the Package, in accordance with the Copyright Holder's procedures. "You" and "your" means any person who would like to copy, distribute, or modify the Package. "Package" means the collection of files distributed by the Copyright Holder, and derivatives of that collection and/or of those files. A given Package may consist of either the Standard Version, or a Modified Version. "Distribute" means providing a copy of the Package or making it accessible to anyone else, or in the case of a company or organization, to others outside of your company or organization. "Distributor Fee" means any fee that you charge for Distributing this Package or providing support for this Package to another party. It does not mean licensing fees. "Standard Version" refers to the Package if it has not been modified, or has been modified only in ways explicitly requested by the Copyright Holder. "Modified Version" means the Package, if it has been changed, and such changes were not explicitly requested by the Copyright Holder. "Original License" means this Artistic License as Distributed with the Standard Version of the Package, in its current version or as it may be modified by The Perl Foundation in the future. "Source" form means the source code, documentation source, and configuration files for the Package. "Compiled" form means the compiled bytecode, object code, binary, or any other form resulting from mechanical transformation or translation of the Source form. Permission for Use and Modification Without Distribution (1) You are permitted to use the Standard Version and create and use Modified Versions for any purpose without restriction, provided that you do not Distribute the Modified Version. Permissions for Redistribution of the Standard Version (2) You may Distribute verbatim copies of the Source form of the Standard Version of this Package in any medium without restriction, either gratis or for a Distributor Fee, provided that you duplicate all of the original copyright notices and associated disclaimers. At your discretion, such verbatim copies may or may not include a Compiled form of the Package. (3) You may apply any bug fixes, portability changes, and other modifications made available from the Copyright Holder. The resulting Package will still be considered the Standard Version, and as such will be subject to the Original License. Distribution of Modified Versions of the Package as Source (4) You may Distribute your Modified Version as Source (either gratis or for a Distributor Fee, and with or without a Compiled form of the Modified Version) provided that you clearly document how it differs from the Standard Version, including, but not limited to, documenting any non-standard features, executables, or modules, and provided that you do at least ONE of the following: (a) make the Modified Version available to the Copyright Holder of the Standard Version, under the Original License, so that the Copyright Holder may include your modifications in the Standard Version. (b) ensure that installation of your Modified Version does not prevent the user installing or running the Standard Version. In addition, the Modified Version must bear a name that is different from the name of the Standard Version. (c) allow anyone who receives a copy of the Modified Version to make the Source form of the Modified Version available to others under (i) the Original License or (ii) a license that permits the licensee to freely copy, modify and redistribute the Modified Version using the same licensing terms that apply to the copy that the licensee received, and requires that the Source form of the Modified Version, and of any works derived from it, be made freely available in that license fees are prohibited but Distributor Fees are allowed. Distribution of Compiled Forms of the Standard Version or Modified Versions without the Source (5) You may Distribute Compiled forms of the Standard Version without the Source, provided that you include complete instructions on how to get the Source of the Standard Version. Such instructions must be valid at the time of your distribution. If these instructions, at any time while you are carrying out such distribution, become invalid, you must provide new instructions on demand or cease further distribution. If you provide valid instructions or cease distribution within thirty days after you become aware that the instructions are invalid, then you do not forfeit any of your rights under this license. (6) You may Distribute a Modified Version in Compiled form without the Source, provided that you comply with Section 4 with respect to the Source of the Modified Version. Aggregating or Linking the Package (7) You may aggregate the Package (either the Standard Version or Modified Version) with other packages and Distribute the resulting aggregation provided that you do not charge a licensing fee for the Package. Distributor Fees are permitted, and licensing fees for other components in the aggregation are permitted. The terms of this license apply to the use and Distribution of the Standard or Modified Versions as included in the aggregation. (8) You are permitted to link Modified and Standard Versions with other works, to embed the Package in a larger work of your own, or to build stand-alone binary or bytecode versions of applications that include the Package, and Distribute the result without restriction, provided the result does not expose a direct interface to the Package. Items That are Not Considered Part of a Modified Version (9) Works (including, but not limited to, modules and scripts) that merely extend or make use of the Package, do not, by themselves, cause the Package to be a Modified Version. In addition, such works are not considered parts of the Package itself, and are not subject to the terms of this license. General Provisions (10) Any use, modification, and distribution of the Standard or Modified Versions is governed by this Artistic License. By using, modifying or distributing the Package, you accept this license. Do not use, modify, or distribute the Package, if you do not accept this license. (11) If your Modified Version has been derived from a Modified Version made by someone other than you, you are nevertheless required to ensure that your Modified Version complies with the requirements of this license. (12) This license does not grant you the right to use any trademark, service mark, tradename, or logo of the Copyright Holder. (13) This license includes the non-exclusive, worldwide, free-of-charge patent license to make, have made, use, offer to sell, sell, import and otherwise transfer the Package with respect to any patent claims licensable by the Copyright Holder that are necessarily infringed by the Package. If you institute patent litigation (including a cross-claim or counterclaim) against any party alleging that the Package constitutes direct or contributory patent infringement, then this Artistic License to you shall terminate on the date that such litigation is filed. (14) Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. t000755000764000764 012532311510 14326 5ustar00shlomifshlomif000000000000Digest-JHash-0.09pod.t100644000764000764 56112532311510 15417 0ustar00shlomifshlomif000000000000Digest-JHash-0.09/tuse Test; #$ENV{RELEASE_TESTING}++; eval "use Test::Pod 1.00"; if ($@) { print "1..0 # Skip Test::Pod 1.00 required for testing POD\n"; } else { if ( $ENV{RELEASE_TESTING} ) { my @poddirs = qw(lib ../lib); all_pod_files_ok(all_pod_files( @poddirs )); } else { print "1..0 # Skip Author only pod tests not required\n"; } } Changes~100644000764000764 262012532311510 15714 0ustar00shlomifshlomif000000000000Digest-JHash-0.09Revision history for Perl extension Digest::JHash. 0.08 2014-01-27 - Add a minimal version on perl-5.8.0. - For CPANTS Kwalitee. - Add t/cpan-changes.t - Add a LICENSE file (for CPANTS Kwalitee). 0.07 2010-09-04 - Got rid of the SIGNATURE file which was out-of-date. - https://rt.cpan.org/Ticket/Display.html?id=61053 0.06 2010-07-26 - Reuploading to get rid of the world-writable files and directories in the archive. 0.05 2008-06-06 - Patched to make algorithm compatible with unwanted 64 bit int in U32 0.04 2008-06-04 - Moved developer only tests kwalitee.t and spelling.t to misc/ to stop kwalitee from demanding they be listed as build pre-reqs in META.yml 0.03 2008-06-04 - Repackaged into Kwalitee compliant package 0.02 2003-04-07 - Changed untar dir structure to standard one - Modified JHash.pm @EXPORT_OK so jhash() function can be exported on demand - A small clean up to handle undef and null string input cases - Added tests for the undef and null string input cases - finished POD - Added speed note to pod and demo script to misc/oo_vs_func.pl - Added DEBUG const to C code for conveneience and to conform with coding conventions of PHB - Cleaned up Makefile.PL to minimal case 0.01 2003-04-06 - original version; created by h2xs 1.21 with options -An Digest::JHash dist.ini100644000764000764 144612532311510 15674 0ustar00shlomifshlomif000000000000Digest-JHash-0.09name = Digest-JHash author = Shlomi Fish license = Artistic_2_0 copyright_holder = Dr James Freeman copyright_year = 2003 [@Filter] -bundle = @Basic -remove = MakeMaker -remove = ExtraTests -remove = License -remove = Readme [AutoPrereqs] [MetaProvides::Package] [PodSyntaxTests] [PodCoverageTests] [Test::CPAN::Changes] [Test::Compile] fake_home = 1 [PruneCruft] [VersionFromModule] [RunExtraTests] [MakeMaker::Awesome] WriteMakefile_arg = 'OBJECT' => 'JHash.o' [MetaResources] bugtracker.web = https://rt.cpan.org/Public/Dist/Display.html?Name=Digest-JHash bugtracker.mailto = bug-digest-jhash@rt.cpan.org repository.url = https://github.com/shlomif/perl-Digest-JHash.git repository.web = https://github.com/shlomif/perl-Digest-JHash repository.type = git [Test::TrailingSpace] JHash.xs100644000764000764 523212532311510 15576 0ustar00shlomifshlomif000000000000Digest-JHash-0.09#include "EXTERN.h" #include "perl.h" #include "XSUB.h" /* Jenkins Hash http://burtleburtle.net/bob/hash/doobs.html */ const int DEBUG = 0; /* Need to constrain U32 to only 32 bits on 64 bit systems * For efficiency we only use the & 0xffffffff if required */ #if BYTEORDER > 0x4321 || defined(TRUNCATE_U32) #define MIX(a,b,c) \ { \ a &= 0xffffffff; b &= 0xffffffff; c &= 0xffffffff; \ a -= b; a -= c; a ^= (c>>13); a &= 0xffffffff; \ b -= c; b -= a; b ^= (a<<8); b &= 0xffffffff; \ c -= a; c -= b; c ^= (b>>13); c &= 0xffffffff; \ a -= b; a -= c; a ^= (c>>12); a &= 0xffffffff; \ b -= c; b -= a; b ^= (a<<16); b &= 0xffffffff; \ c -= a; c -= b; c ^= (b>>5); c &= 0xffffffff; \ a -= b; a -= c; a ^= (c>>3); a &= 0xffffffff; \ b -= c; b -= a; b ^= (a<<10); b &= 0xffffffff; \ c -= a; c -= b; c ^= (b>>15); c &= 0xffffffff; \ } #else #define MIX(a,b,c) \ { \ a -= b; a -= c; a ^= (c>>13); \ b -= c; b -= a; b ^= (a<<8); \ c -= a; c -= b; c ^= (b>>13); \ a -= b; a -= c; a ^= (c>>12); \ b -= c; b -= a; b ^= (a<<16); \ c -= a; c -= b; c ^= (b>>5); \ a -= b; a -= c; a ^= (c>>3); \ b -= c; b -= a; b ^= (a<<10); \ c -= a; c -= b; c ^= (b>>15); \ } #endif U32 jhash( SV* str ) { STRLEN rawlen; char* p; U32 a, b, c, len, length; /* extract the string data and string length from the perl scalar */ p = (char*)SvPV(str, rawlen); length = len = (U32)rawlen; /* Test for undef or null string case and return 0 */ if ( length == 0 ) { DEBUG && printf( "Recieved a null or undef string!\n" ); return 0; } DEBUG && printf( "Received string '%.*s'.\n", (int)len, p ); a = b = 0x9e3779b9; /* golden ratio suggested by Jenkins */ c = 0; while (len >= 12) { a += (p[0] + (((U32)p[1])<<8) + (((U32)p[2])<<16) + (((U32)p[3])<<24)); b += (p[4] + (((U32)p[5])<<8) + (((U32)p[6])<<16) + (((U32)p[7])<<24)); c += (p[8] + (((U32)p[9])<<8) + (((U32)p[10])<<16) + (((U32)p[11])<<24)); MIX(a, b, c); p += 12; len -= 12; } c += length; switch(len) { case 11: c+=((U32)p[10]<<24); case 10: c+=((U32)p[9]<<16); case 9: c+=((U32)p[8]<<8); case 8: b+=((U32)p[7]<<24); case 7: b+=((U32)p[6]<<16); case 6: b+=((U32)p[5]<<8); case 5: b+=((U32)p[4]); case 4: a+=((U32)p[3]<<24); case 3: a+=((U32)p[2]<<16); case 2: a+=((U32)p[1]<<8); case 1: a+=((U32)p[0]); } MIX(a, b, c); DEBUG && printf( "Hash value is %d.\n", (int)(c) ); return(c); } MODULE = Digest::JHash PACKAGE = Digest::JHash PROTOTYPES: ENABLE U32 jhash(str) SV* str META.yml100644000764000764 154112532311510 15475 0ustar00shlomifshlomif000000000000Digest-JHash-0.09--- abstract: 'Perl extension for 32 bit Jenkins Hashing Algorithm' author: - 'Shlomi Fish ' build_requires: Cwd: '0' File::Spec: '0' File::Temp: '0' IO::Handle: '0' IPC::Open3: '0' Test: '0' Test::More: '0' configure_requires: ExtUtils::MakeMaker: '0' dynamic_config: 0 generated_by: 'Dist::Zilla version 5.031, CPAN::Meta::Converter version 2.142060' license: artistic_2 meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: Digest-JHash provides: Digest::JHash: file: lib/Digest/JHash.pm version: '0.09' requires: DynaLoader: '0' Exporter: '0' perl: '5.008' strict: '0' vars: '0' warnings: '0' resources: bugtracker: https://rt.cpan.org/Public/Dist/Display.html?Name=Digest-JHash repository: https://github.com/shlomif/perl-Digest-JHash.git version: '0.09' MANIFEST100644000764000764 101412532311510 15350 0ustar00shlomifshlomif000000000000Digest-JHash-0.09# This file was automatically generated by Dist::Zilla::Plugin::Manifest v5.031. Changes Changes~ JHash.xs LICENSE MANIFEST META.yml Makefile.PL README dist.ini dist.ini~ examples/jhash.pl examples/oo_vs_func.pl html/JHash.html html/docs.css lib/Digest/JHash.pm lib/Digest/JHash.pm~ misc/kwalitee.t misc/make_manifest.pl misc/mkdist.bat misc/spelling.t t/00-compile.t t/cpan-changes.t t/jhash.t t/pod.t t/pod_coverage.t xt/release/cpan-changes.t xt/release/pod-coverage.t xt/release/pod-syntax.t xt/release/trailing-space.t dist.ini~100644000764000764 146212532311510 16070 0ustar00shlomifshlomif000000000000Digest-JHash-0.09name = Digest-JHash author = Shlomi Fish license = Artistic_2_0 copyright_holder = Dr James Freeman copyright_year = 2003 [@Filter] -bundle = @Basic -remove = MakeMaker -remove = ExtraTests -remove = License -remove = Readme [AutoPrereqs] [MetaProvides::Package] [PodSyntaxTests] [PodCoverageTests] [Test::CPAN::Changes] [Test::Compile] fake_home = 1 [PruneCruft] [VersionFromModule] [RunExtraTests] [MakeMaker::Awesome] WriteMakefile_arg = 'OBJECT' => 'JHash.o' [MetaResources] bugtracker.web = https://rt.cpan.org/Public/Dist/Display.html?Name=Digest-JHash bugtracker.mailto = bug-digest-jhash@rt.cpan.org repository.url = https://github.com/shlomif/perl-Digest-JHash.git repository.web = https://github.com/shlomif/perl-Digest-JHash repository.type = git [PodWeaver] [Test::TrailingSpace] jhash.t100644000764000764 71712532311510 15735 0ustar00shlomifshlomif000000000000Digest-JHash-0.09/tuse Test; use strict; BEGIN { plan tests => 5 }; use Digest::JHash; ok(1); # If we made it this far, we loaded ok ok( Digest::JHash::jhash("hello world"), 447289830 ); ok( Digest::JHash::jhash("goodbye cruel world"), 969307542 ); # make sure we don't explode unexpectedly if passed null { # kill warnings in this block local $^W = 0; ok( Digest::JHash::jhash(undef), 0 ); ok( Digest::JHash::jhash(''), 0 ); } # warnings are active again here Makefile.PL100644000764000764 322012532311510 16172 0ustar00shlomifshlomif000000000000Digest-JHash-0.09# This Makefile.PL for Digest-JHash was generated by # Dist::Zilla::Plugin::MakeMaker::Awesome 0.24 # and Dist::Zilla::Plugin::MakeMaker::Awesome 0.24. # Don't edit it but the dist.ini and plugins used to construct it. use strict; use warnings; use 5.008; use ExtUtils::MakeMaker; my %WriteMakefileArgs = ( "ABSTRACT" => "Perl extension for 32 bit Jenkins Hashing Algorithm", "AUTHOR" => "Shlomi Fish ", "CONFIGURE_REQUIRES" => { "ExtUtils::MakeMaker" => 0 }, "DISTNAME" => "Digest-JHash", "EXE_FILES" => [], "LICENSE" => "artistic_2", "NAME" => "Digest::JHash", "PREREQ_PM" => { "DynaLoader" => 0, "Exporter" => 0, "strict" => 0, "vars" => 0, "warnings" => 0 }, "TEST_REQUIRES" => { "Cwd" => 0, "File::Spec" => 0, "File::Temp" => 0, "IO::Handle" => 0, "IPC::Open3" => 0, "Test" => 0, "Test::More" => 0 }, "VERSION" => "0.09", "test" => { "TESTS" => "t/*.t" } ); %WriteMakefileArgs = ( %WriteMakefileArgs, 'OBJECT' => 'JHash.o', ); my %FallbackPrereqs = ( "Cwd" => 0, "DynaLoader" => 0, "Exporter" => 0, "ExtUtils::MakeMaker" => 0, "File::Spec" => 0, "File::Temp" => 0, "IO::Handle" => 0, "IPC::Open3" => 0, "Test" => 0, "Test::More" => 0, "strict" => 0, "vars" => 0, "warnings" => 0 ); unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) { delete $WriteMakefileArgs{TEST_REQUIRES}; delete $WriteMakefileArgs{BUILD_REQUIRES}; $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs; } delete $WriteMakefileArgs{CONFIGURE_REQUIRES} unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; WriteMakefile(%WriteMakefileArgs); html000755000764000764 012532311510 15027 5ustar00shlomifshlomif000000000000Digest-JHash-0.09docs.css100644000764000764 426212532311510 16635 0ustar00shlomifshlomif000000000000Digest-JHash-0.09/htmlBODY { font: small verdana, arial, helvetica, sans-serif; color: black; background-color: white; } A:link {color: #0000FF} A:visited {color: #666666} A:active {color: #FF0000} H1 { font: bold large verdana, arial, helvetica, sans-serif; color: black; } H2 { font: bold large verdana, arial, helvetica, sans-serif; color: maroon; } H3 { font: bold medium verdana, arial, helvetica, sans-serif; color: blue; } H4 { font: bold small verdana, arial, helvetica, sans-serif; color: maroon; } H5 { font: bold small verdana, arial, helvetica, sans-serif; color: blue; } H6 { font: bold small verdana, arial, helvetica, sans-serif; color: black; } UL { font: small verdana, arial, helvetica, sans-serif; color: black; } OL { font: small verdana, arial, helvetica, sans-serif; color: black; } LI { font: small verdana, arial, helvetica, sans-serif; color: black; } TH { font: small verdana, arial, helvetica, sans-serif; color: black; } TD { font: small verdana, arial, helvetica, sans-serif; color: black; } TD.foot { font: medium sans-serif; color: #eeeeee; background-color="#cc0066" } DL { font: small verdana, arial, helvetica, sans-serif; color: black; } DD { font: small verdana, arial, helvetica, sans-serif; color: black; } DT { font: small verdana, arial, helvetica, sans-serif; color: black; } CODE { font: Courier, monospace; } PRE { font: Courier, monospace; } P.indent { font: small verdana, arial, helvetica, sans-serif; color: black; background-color: white; list-style-type : circle; list-style-position : inside; margin-left : 16.0pt; } PRE.programlisting { font-size : 9.0pt; list-style-type : disc; margin-left : 16.0pt; margin-top : -14.0pt; } INPUT { font: bold small verdana, arial, helvetica, sans-serif; color: black; background-color: white; } TEXTAREA { font: bold small verdana, arial, helvetica, sans-serif; color: black; background-color: white; } .BANNER { background-color: "#cccccc"; font: bold medium verdana, arial, helvetica, sans-serif; } 00-compile.t100644000764000764 211312532311510 16515 0ustar00shlomifshlomif000000000000Digest-JHash-0.09/tuse 5.006; use strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::Compile 2.046 use Test::More tests => 1 + ($ENV{AUTHOR_TESTING} ? 1 : 0); my @module_files = ( 'Digest/JHash.pm' ); # fake home for cpan-testers use File::Temp; local $ENV{HOME} = File::Temp::tempdir( CLEANUP => 1 ); my $inc_switch = -d 'blib' ? '-Mblib' : '-Ilib'; use File::Spec; use IPC::Open3; use IO::Handle; open my $stdin, '<', File::Spec->devnull or die "can't open devnull: $!"; my @warnings; for my $lib (@module_files) { # see L my $stderr = IO::Handle->new; my $pid = open3($stdin, '>&STDERR', $stderr, $^X, $inc_switch, '-e', "require q[$lib]"); binmode $stderr, ':crlf' if $^O eq 'MSWin32'; my @_warnings = <$stderr>; waitpid($pid, 0); is($?, 0, "$lib loaded ok"); if (@_warnings) { warn @_warnings; push @warnings, @_warnings; } } is(scalar(@warnings), 0, 'no warnings found') or diag 'got warnings: ', explain \@warnings if $ENV{AUTHOR_TESTING}; misc000755000764000764 012532311510 15016 5ustar00shlomifshlomif000000000000Digest-JHash-0.09spelling.t100644000764000764 125012532311510 17156 0ustar00shlomifshlomif000000000000Digest-JHash-0.09/miscuse Test; use Cwd; my $ASPELL = "C:\\usr\\Aspell\\bin\\aspell.exe"; #$ENV{RELEASE_TESTING}++; my $chdir = 0; if ( cwd() =~ m/t$/ ) { chdir ".."; $chdir++; } eval { require Test::Spelling; Test::Spelling->import; }; if ($@) { plan tests => 1; skip("Test::Spelling not installed; skipping"); } else { if ( $ENV{RELEASE_TESTING} ) { set_spell_cmd("$ASPELL -l"); add_stopwords(); all_pod_files_spelling_ok('lib'); } else { plan tests => 1; skip( "Author only private tests" ); } } chdir "t" if $chdir; # back to t/ __DATA__ CGI CPAN GPL STDIN STDOUT DWIM OO RTFM RTFS James Freeman gmail behaviour mkdist.bat100755000764000764 14012532311510 17117 0ustar00shlomifshlomif000000000000Digest-JHash-0.09/miscperl Makefile.PL nmake realclean perl misc\make_manifest.pl perl Makefile.PL nmake distsignaturekwalitee.t100644000764000764 67512532311510 17140 0ustar00shlomifshlomif000000000000Digest-JHash-0.09/miscuse Test; use Cwd; #$ENV{RELEASE_TESTING}++; my $chdir = 0; if ( cwd() =~ m/t$/ ) { chdir ".."; $chdir++; } eval { require Test::Kwalitee;}; if ($@) { plan tests => 1; skip("Test::Kwalitee not installed; skipping"); } else { if ( $ENV{RELEASE_TESTING} ) { Test::Kwalitee->import(); } else { plan tests => 1; skip( "Author only private tests" ); } } chdir "t" if $chdir; # back to t/ JHash.html100644000764000764 1115512532311510 17075 0ustar00shlomifshlomif000000000000Digest-JHash-0.09/html JHash.pm
 JHash.pm


NAME

Digest::JHash - Perl extension for 32 bit Jenkins Hashing Algorithm


SYNOPSIS

    use Digest::JHash qw(jhash);
    $digest = jhash($data);
    # note that calling jhash() directly like this is the fastest way:
    $digest = Digest::JHash::jhash($data);


DESCRIPTION

The Digest::JHash module allows you to use the fast JHash hashing algorithm developed by Bob Jenkins from within Perl programs. The algorithm takes as input a message of arbitrary length and produces as output a 32-bit "message digest" of the input in the form of an unsigned long integer.

Call it a low calorie version of MD5 if you like.

See http://burtleburtle.net/bob/hash/doobs.html for more information.


FUNCTIONS

jhash($data)

This function will calculate the JHash digest of the "message" in $data and return a 32 bit integer result (an unsigned long in the C)


EXPORTS

None by default but you can have the jhash() function if you ask nicely. See below for reasons not to use Exporter (it is slower than a direct call)


SPEED NOTE

If speed is a major issue it is roughly twice as fast to do call the jhash() function like Digest::JHash::jhash('message') than it is to import the jhash() method using Exporter so you can call it as simply jhash('message'). There is a short script that demonstrates the speed of different calling methods (direct, OO and Imported) in examples/oo_vs_func.pl


AUTHORS

The JHash implementation was written by Bob Jenkins <bob_jenkins [at] burtleburtle [dot] net>.

This perl extension was written by Andrew Towers <mariofrog [at] bigpond [dot] com>.

A few mods were added by James Freeman <airmedical [at] gmail [dot] com>).


SEE ALSO

http://burtleburtle.net/bob/hash/doobs.html


LICENSE

This package is free software and is provided "as is" without express or implied warranty. It may be used, redistributed and/or modified under the terms of the Artistic License 2.0. A copy is include in this distribution.

 JHash.pm
cpan-changes.t100644000764000764 26212532311510 17162 0ustar00shlomifshlomif000000000000Digest-JHash-0.09/t#!/usr/bin/perl use strict; use warnings; use Test::More; eval 'use Test::CPAN::Changes'; plan skip_all => 'Test::CPAN::Changes required for this test' if $@; changes_ok(); pod_coverage.t100644000764000764 123212532311510 17306 0ustar00shlomifshlomif000000000000Digest-JHash-0.09/tuse Test; use Cwd; my $ALSO_PRIVATE = [ ]; #$ENV{RELEASE_TESTING}++; my $chdir = 0; # Test::Pod::Coverage is brain dead and won't find # lib or blib when run from t/, nor can you tell it # where to look if ( cwd() =~ m/t$/ ) { chdir ".."; $chdir++; } eval "use Test::Pod::Coverage 1.00"; if ($@) { print "1..0 Skip # Test::Pod::Coverage 1.00 required for testing POD\n"; } else { if ( $ENV{RELEASE_TESTING} ) { all_pod_coverage_ok( { also_private => $ALSO_PRIVATE } ); } else { print "1..0 # Skip Author only pod coverage tests not required\n"; } } chdir "t" if $chdir; # back to t/examples000755000764000764 012532311510 15701 5ustar00shlomifshlomif000000000000Digest-JHash-0.09jhash.pl100644000764000764 63212532311510 17454 0ustar00shlomifshlomif000000000000Digest-JHash-0.09/examples#!/usr/bin/perl -w use strict; use Digest::JHash 'jhash'; if ($ARGV[0]) { if ( -f $ARGV[0] ) { local $/; open F, $ARGV[0] or die "Can't read $ARGV[0] $!\n"; my $data = ; close F; printf "File: $ARGV[0] => %u\n", jhash($data); } else { printf "String: $ARGV[0] => %u\n", jhash($ARGV[0]); } } else { print "Usage $0 \n"; } Digest000755000764000764 012532311510 16050 5ustar00shlomifshlomif000000000000Digest-JHash-0.09/libJHash.pm100644000764000764 446212532311510 17551 0ustar00shlomifshlomif000000000000Digest-JHash-0.09/lib/Digestpackage Digest::JHash; use strict; use warnings; require 5.008; require Exporter; require DynaLoader; use vars qw(@ISA @EXPORT_OK $VERSION); @ISA = qw(Exporter DynaLoader); @EXPORT_OK = qw( jhash ); $VERSION = '0.09'; bootstrap Digest::JHash $VERSION; 1; __END__ =head1 NAME Digest::JHash - Perl extension for 32 bit Jenkins Hashing Algorithm =head1 SYNOPSIS use Digest::JHash qw(jhash); $digest = jhash($data); # note that calling jhash() directly like this is the fastest way: $digest = Digest::JHash::jhash($data); =head1 DESCRIPTION The C module allows you to use the fast JHash hashing algorithm developed by Bob Jenkins from within Perl programs. The algorithm takes as input a message of arbitrary length and produces as output a 32-bit "message digest" of the input in the form of an unsigned long integer. Call it a low calorie version of MD5 if you like. See http://burtleburtle.net/bob/hash/doobs.html for more information. =head1 FUNCTIONS =over 4 =item jhash($data) This function will calculate the JHash digest of the "message" in $data and return a 32 bit integer result (an unsigned long in the C) =back =head1 EXPORTS None by default but you can have the jhash() function if you ask nicely. See below for reasons not to use Exporter (it is slower than a direct call) =head1 SPEED NOTE If speed is a major issue it is roughly twice as fast to do call the jhash() function like Digest::JHash::jhash('message') than it is to import the jhash() method using Exporter so you can call it as simply jhash('message'). There is a short script that demonstrates the speed of different calling methods (direct, OO and Imported) in examples/oo_vs_func.pl =head1 AUTHORS The JHash implementation was written by Bob Jenkins . This perl extension was written by Andrew Towers . A few mods were added by James Freeman ). =head1 SEE ALSO http://burtleburtle.net/bob/hash/doobs.html =head1 LICENSE This package is free software and is provided "as is" without express or implied warranty. It may be used, redistributed and/or modified under the terms of the Artistic License 2.0. A copy is include in this distribution. =for stopwords JHash burtleburtle bigpond Jenkins =cut JHash.pm~100644000764000764 446212532311510 17747 0ustar00shlomifshlomif000000000000Digest-JHash-0.09/lib/Digestpackage Digest::JHash; use strict; use warnings; require 5.008; require Exporter; require DynaLoader; use vars qw(@ISA @EXPORT_OK $VERSION); @ISA = qw(Exporter DynaLoader); @EXPORT_OK = qw( jhash ); $VERSION = '0.08'; bootstrap Digest::JHash $VERSION; 1; __END__ =head1 NAME Digest::JHash - Perl extension for 32 bit Jenkins Hashing Algorithm =head1 SYNOPSIS use Digest::JHash qw(jhash); $digest = jhash($data); # note that calling jhash() directly like this is the fastest way: $digest = Digest::JHash::jhash($data); =head1 DESCRIPTION The C module allows you to use the fast JHash hashing algorithm developed by Bob Jenkins from within Perl programs. The algorithm takes as input a message of arbitrary length and produces as output a 32-bit "message digest" of the input in the form of an unsigned long integer. Call it a low calorie version of MD5 if you like. See http://burtleburtle.net/bob/hash/doobs.html for more information. =head1 FUNCTIONS =over 4 =item jhash($data) This function will calculate the JHash digest of the "message" in $data and return a 32 bit integer result (an unsigned long in the C) =back =head1 EXPORTS None by default but you can have the jhash() function if you ask nicely. See below for reasons not to use Exporter (it is slower than a direct call) =head1 SPEED NOTE If speed is a major issue it is roughly twice as fast to do call the jhash() function like Digest::JHash::jhash('message') than it is to import the jhash() method using Exporter so you can call it as simply jhash('message'). There is a short script that demonstrates the speed of different calling methods (direct, OO and Imported) in examples/oo_vs_func.pl =head1 AUTHORS The JHash implementation was written by Bob Jenkins . This perl extension was written by Andrew Towers . A few mods were added by James Freeman ). =head1 SEE ALSO http://burtleburtle.net/bob/hash/doobs.html =head1 LICENSE This package is free software and is provided "as is" without express or implied warranty. It may be used, redistributed and/or modified under the terms of the Artistic License 2.0. A copy is include in this distribution. =for stopwords JHash burtleburtle bigpond Jenkins =cut make_manifest.pl100644000764000764 1335512532311510 20345 0ustar00shlomifshlomif000000000000Digest-JHash-0.09/misc#!/usr/bin/perl -w # make_manifest.pl - get ready to tarball a module for CPAN # It makes really clean, writes a /html dir from the .pm pod, # writes an accurate manifest and then fixes up all the line endings. use strict; use Pod::Html; use Cwd; chdir ".." if cwd =~ m/misc$/; my $backup = 0; my $root = shift @ARGV || '.'; #'../; $root =~ tr|\\|/|; $root = "$root/" unless $root =~ m|/$|; write_file("SIGNATURE"); write_file("META.yml"); make_clean($root); my $htmldir = $root."html/"; mkdir $htmldir, 0777; # make the html dir unlink <$htmldir*>; # make sure it is empty # write license file require Software::License::Artistic_2_0; unless ($@) { my $license = Software::License::Artistic_2_0->new({holder => 'James Freeman',}); open F, ">../LICENSE" or die "Can't write LICENSE $!\n"; print F $license->fulltext; close F; } my ( $dirs, $files ) = recurse_tree($root); my @files; # erase any undesirable files ie .bak, .pbp for (@$files) { unlink, next if m/\.(?:pbp|bak|gz)$/; push @files, $_; # add files that we don't erase } # write the HTML write_file( $htmldir."docs.css", (join'',) ); # write the css push @files, $htmldir."docs.css"; for my $pm (grep { m/\.pm$/ } @files ) { my $name = make_html($pm); push @files, $htmldir.$name; } # clean up after pod2html! unlink <./pod2htm*>; # write the MANIFEST; unshift @files, $root.'MANIFEST'; write_file( $root."MANIFEST", (join"\n", map{ m/\Q$root\E(.*)/o ;$1 }@files) ); # fix line endings fix_line_endings($_) for @files; # remove all the makefile/make rubbish sub make_clean { my $root = shift; my ($dirs, $files) = recurse_tree( $root."blib/" ); my @dirs = @$dirs; my @files = @$files; unlink for @files; # need to do longest dir paths first - must be deepest rmdir for sort {length $b <=> length $a }@dirs; my @makefiles = grep { /makefile(?!\.PL)/i } <$root*>; unlink for ( @makefiles, $root.'&1', $root.'pm_to_blib', $root.'MANIFEST', $root.'manifest' ); unlink <${root}pod2htm*>; } # recurse the directory tree sub recurse_tree { my $root = shift; my @files; my @dirs = ($root); for my $dir (@dirs) { opendir DIR, $dir or next; while (my $file = readdir DIR) { next if $file eq '.' or $file eq '..'; next if -l "$dir$file"; if ( -d "$dir$file" ) { push @dirs, "$dir$file/"; } elsif ( -f "$dir$file" ) { push @files, "$dir$file"; } } closedir DIR; } return \@dirs, \@files; } # clean windows line ending away sub fix_line_endings { my $file = shift; return if $file =~ m/.bat$/; local $/; open my $fh, "+<$file" or die "Can't open $file for R/W $!\n"; binmode $fh; my $data = <$fh>; write_file( "$file.bak" , $data ) if $backup; $data =~ s/\015\012/\012/g; $data =~ s/ +\012/\012/g; $data =~ s/\t/ /g; seek $fh, 0, 0; truncate $fh, 0; print $fh $data; close $fh; $file =~ s/\Q$root\E//o; print "Processed $file\n"; } # make HTML from the pod sub make_html { my $file = shift; (my $name) = $file =~ m/([^\/\\]+)\.pm$/; print "Writing html/$name.html\n"; pod2html( "--infile=$file", "--header", "--title=$name.pm", "--css=${htmldir}docs.css", "--outfile=$htmldir$name.html", "--quiet" ); return "$name.html"; } sub write_file { my $file = shift; open F, ">$file" or die "Can't write $file: $!\n"; print F for @_; close F; } __DATA__ BODY { font: small verdana, arial, helvetica, sans-serif; color: black; background-color: white; } A:link {color: #0000FF} A:visited {color: #666666} A:active {color: #FF0000} H1 { font: bold large verdana, arial, helvetica, sans-serif; color: black; } H2 { font: bold large verdana, arial, helvetica, sans-serif; color: maroon; } H3 { font: bold medium verdana, arial, helvetica, sans-serif; color: blue; } H4 { font: bold small verdana, arial, helvetica, sans-serif; color: maroon; } H5 { font: bold small verdana, arial, helvetica, sans-serif; color: blue; } H6 { font: bold small verdana, arial, helvetica, sans-serif; color: black; } UL { font: small verdana, arial, helvetica, sans-serif; color: black; } OL { font: small verdana, arial, helvetica, sans-serif; color: black; } LI { font: small verdana, arial, helvetica, sans-serif; color: black; } TH { font: small verdana, arial, helvetica, sans-serif; color: black; } TD { font: small verdana, arial, helvetica, sans-serif; color: black; } TD.foot { font: medium sans-serif; color: #eeeeee; background-color="#cc0066" } DL { font: small verdana, arial, helvetica, sans-serif; color: black; } DD { font: small verdana, arial, helvetica, sans-serif; color: black; } DT { font: small verdana, arial, helvetica, sans-serif; color: black; } CODE { font: Courier, monospace; } PRE { font: Courier, monospace; } P.indent { font: small verdana, arial, helvetica, sans-serif; color: black; background-color: white; list-style-type : circle; list-style-position : inside; margin-left : 16.0pt; } PRE.programlisting { font-size : 9.0pt; list-style-type : disc; margin-left : 16.0pt; margin-top : -14.0pt; } INPUT { font: bold small verdana, arial, helvetica, sans-serif; color: black; background-color: white; } TEXTAREA { font: bold small verdana, arial, helvetica, sans-serif; color: black; background-color: white; } .BANNER { background-color: "#cccccc"; font: bold medium verdana, arial, helvetica, sans-serif; } oo_vs_func.pl100644000764000764 207312532311510 20540 0ustar00shlomifshlomif000000000000Digest-JHash-0.09/examples#!/usr/bin/perl package Test; use Benchmark; $count = 10_000_000; $foo = new Foo; # import do_foo into this package, normally exported out of package Foo # using Exporter but this is the key line of code that does it *{Test::do_foo} = sub { Foo::do_foo() }; timethese( $count, { 'OO' => '$foo->do_foo()', 'Function' => 'Foo::do_foo()', 'Import' => 'do_foo()', } ); # note that $oo and $ff got auto-vivified (not declared, made on first use) # this is one of the reasons so many people write shit code in Perl. printf "\nOO %d\nFF %d\n", $oo, $ff; package Foo; sub new { bless { key => 'val' }, shift } sub do_foo { $_[0] ? $Test::oo++ : $Test::ff++ } __DATA__ Benchmark: timing 10000000 iterations of Function, Import, OO... Function: 8 wallclock secs ( 7.99 usr + 0.00 sys = 7.99 CPU) @ 1251251.25/s (n=10000000) Import: 12 wallclock secs (12.72 usr + 0.00 sys = 12.72 CPU) @ 786225.33/s (n=10000000) OO: 9 wallclock secs ( 9.33 usr + 0.00 sys = 9.33 CPU) @ 1071352.05/s (n=10000000) OO 10000000 FF 20000000 release000755000764000764 012532311510 16136 5ustar00shlomifshlomif000000000000Digest-JHash-0.09/xtpod-syntax.t100644000764000764 22012532311510 20543 0ustar00shlomifshlomif000000000000Digest-JHash-0.09/xt/release#!perl # This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests. use Test::More; use Test::Pod 1.41; all_pod_files_ok(); pod-coverage.t100644000764000764 33412532311510 21016 0ustar00shlomifshlomif000000000000Digest-JHash-0.09/xt/release#!perl # This file was automatically generated by Dist::Zilla::Plugin::PodCoverageTests. use Test::Pod::Coverage 1.08; use Pod::Coverage::TrustPod; all_pod_coverage_ok({ coverage_class => 'Pod::Coverage::TrustPod' }); cpan-changes.t100644000764000764 26312532311510 20773 0ustar00shlomifshlomif000000000000Digest-JHash-0.09/xt/release#!perl use strict; use warnings; use Test::More 0.96 tests => 2; use_ok('Test::CPAN::Changes'); subtest 'changes_ok' => sub { changes_file_ok('Changes'); }; done_testing(); trailing-space.t100644000764000764 103412532311510 21363 0ustar00shlomifshlomif000000000000Digest-JHash-0.09/xt/release#!perl use strict; use warnings; use Test::More; eval "use Test::TrailingSpace"; if ($@) { plan skip_all => "Test::TrailingSpace required for trailing space test."; } else { plan tests => 1; } # TODO: add .pod, .PL, the README/Changes/TODO/etc. documents and possibly # some other stuff. my $finder = Test::TrailingSpace->new( { root => '.', filename_regex => qr#(?:\.(?:t|pm|pl|xs|c|h|txt|pod|PL)|README|Changes|TODO|LICENSE)\z#, }, ); # TEST $finder->no_trailing_space( "No trailing space was found." );