r10245 - in /branches/upstream/libmd5-perl: ./ current/ current/Changes current/MANIFEST current/MD5.pm current/Makefile.PL current/README current/t/ current/t/md5.t
vdanjean at users.alioth.debian.org
vdanjean at users.alioth.debian.org
Sat Dec 1 12:06:42 UTC 2007
Author: vdanjean
Date: Sat Dec 1 12:06:42 2007
New Revision: 10245
URL: http://svn.debian.org/wsvn/?sc=1&rev=10245
Log:
[svn-inject] Installing original source of libmd5-perl
Added:
branches/upstream/libmd5-perl/
branches/upstream/libmd5-perl/current/
branches/upstream/libmd5-perl/current/Changes
branches/upstream/libmd5-perl/current/MANIFEST
branches/upstream/libmd5-perl/current/MD5.pm
branches/upstream/libmd5-perl/current/Makefile.PL
branches/upstream/libmd5-perl/current/README
branches/upstream/libmd5-perl/current/t/
branches/upstream/libmd5-perl/current/t/md5.t
Added: branches/upstream/libmd5-perl/current/Changes
URL: http://svn.debian.org/wsvn/branches/upstream/libmd5-perl/current/Changes?rev=10245&op=file
==============================================================================
--- branches/upstream/libmd5-perl/current/Changes (added)
+++ branches/upstream/libmd5-perl/current/Changes Sat Dec 1 12:06:42 2007
@@ -1,0 +1,14 @@
+2003-11-27 Gisle Aas <gisle at ActiveState.com>
+
+ Release 2.03
+
+ Removed the word "basically" from the documentation.
+
+
+
+2000-03-13 Gisle Aas <gisle at ActiveState.com>
+
+ Release 2.02
+
+ Broken out of the Digest-MD5-2.12 distribution and made into
+ a separate dist.
Added: branches/upstream/libmd5-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/branches/upstream/libmd5-perl/current/MANIFEST?rev=10245&op=file
==============================================================================
--- branches/upstream/libmd5-perl/current/MANIFEST (added)
+++ branches/upstream/libmd5-perl/current/MANIFEST Sat Dec 1 12:06:42 2007
@@ -1,0 +1,6 @@
+Changes
+MANIFEST
+MD5.pm
+Makefile.PL
+README
+t/md5.t
Added: branches/upstream/libmd5-perl/current/MD5.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libmd5-perl/current/MD5.pm?rev=10245&op=file
==============================================================================
--- branches/upstream/libmd5-perl/current/MD5.pm (added)
+++ branches/upstream/libmd5-perl/current/MD5.pm Sat Dec 1 12:06:42 2007
@@ -1,0 +1,54 @@
+package MD5; # legacy stuff
+
+use strict;
+use vars qw($VERSION @ISA);
+
+$VERSION = '2.03'; # $Date: 2003/11/27 08:42:40 $
+
+require Digest::MD5;
+ at ISA=qw(Digest::MD5);
+
+sub hash { shift->new->add(@_)->digest; }
+sub hexhash { shift->new->add(@_)->hexdigest; }
+
+1;
+__END__
+
+=head1 NAME
+
+MD5 - Perl interface to the MD5 Message-Digest Algorithm
+
+=head1 SYNOPSIS
+
+ use MD5;
+
+ $context = new MD5;
+ $context->reset();
+
+ $context->add(LIST);
+ $context->addfile(HANDLE);
+
+ $digest = $context->digest();
+ $string = $context->hexdigest();
+
+ $digest = MD5->hash(SCALAR);
+ $string = MD5->hexhash(SCALAR);
+
+=head1 DESCRIPTION
+
+The C<MD5> module is B<depreciated>. Use C<Digest::MD5> instead.
+
+The current C<MD5> module is just a wrapper around the C<Digest::MD5>
+module. It is provided so that legacy code that rely on the old
+interface still work and get the speed benefit of the new module.
+
+In addition to the methods provided for C<Digest::MD5> objects, this
+module provide the class methods MD5->hash() and MD5->hexhash() that
+do the same as the md5() and md5_hex() functions provided by
+C<Digest::MD5>.
+
+=head1 SEE ALSO
+
+L<Digest::MD5>
+
+=cut
Added: branches/upstream/libmd5-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/branches/upstream/libmd5-perl/current/Makefile.PL?rev=10245&op=file
==============================================================================
--- branches/upstream/libmd5-perl/current/Makefile.PL (added)
+++ branches/upstream/libmd5-perl/current/Makefile.PL Sat Dec 1 12:06:42 2007
@@ -1,0 +1,9 @@
+require 5.004;
+use ExtUtils::MakeMaker;
+
+WriteMakefile(
+ 'NAME' => 'MD5',
+ 'VERSION_FROM' => 'MD5.pm',
+ 'PREREQ_PM' => { 'Digest::MD5' => 2.00, },
+ 'dist' => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
+);
Added: branches/upstream/libmd5-perl/current/README
URL: http://svn.debian.org/wsvn/branches/upstream/libmd5-perl/current/README?rev=10245&op=file
==============================================================================
--- branches/upstream/libmd5-perl/current/README (added)
+++ branches/upstream/libmd5-perl/current/README Sat Dec 1 12:06:42 2007
@@ -1,0 +1,15 @@
+This module is depreciated. Please use Digest::MD5 instead.
+
+This module (MD5.pm) is just a thin wrapper around the Digest::MD5
+module. It is provided so that legacy code that rely on the old
+interface continue to work with the speed benefit of the new module.
+
+You will need perl version 5.004 or better to install this module.
+The Digest::MD5 module must be installed.
+
+Copyright 1998-2001 Gisle Aas.
+Copyright 1995-1996 Neil Winton.
+Copyright 1990-1992 RSA Data Security, Inc.
+
+This library is free software; you can redistribute it and/or
+modify it under the same terms as Perl itself.
Added: branches/upstream/libmd5-perl/current/t/md5.t
URL: http://svn.debian.org/wsvn/branches/upstream/libmd5-perl/current/t/md5.t?rev=10245&op=file
==============================================================================
--- branches/upstream/libmd5-perl/current/t/md5.t (added)
+++ branches/upstream/libmd5-perl/current/t/md5.t Sat Dec 1 12:06:42 2007
@@ -1,0 +1,173 @@
+######################### We start with some black magic to print on failure.
+
+# Change 1..1 below to 1..last_test_to_print .
+# (It may become useful if the test is moved to ./t subdirectory.)
+
+BEGIN {print "1..14\n";}
+END {print "not ok 1\n" unless $loaded;}
+use MD5;
+$loaded = 1;
+print "ok 1\n";
+
+######################### End of black magic.
+
+# Insert your test code below (better if it prints "ok 13"
+# (correspondingly "not ok 13") depending on the success of chunk 13
+# of the test code):
+
+package MD5Test;
+
+# 2: Constructor
+
+print (($md5 = new MD5) ? "ok 2\n" : "not ok 2\n");
+
+# 3: Basic test data as defined in RFC 1321
+
+%data = (
+ "" => "d41d8cd98f00b204e9800998ecf8427e",
+ "a" => "0cc175b9c0f1b6a831c399e269772661",
+ "abc" => "900150983cd24fb0d6963f7d28e17f72",
+ "message digest"
+ => "f96b697d7cb7938d525a2f31aaf161d0",
+ "abcdefghijklmnopqrstuvwxyz"
+ => "c3fcd3d76192e4007dfb496cca67e13b",
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
+ => "d174ab98d277d9f5a5611c2c9f419d9f",
+ "12345678901234567890123456789012345678901234567890123456789012345678901234567890"
+ => "57edf4a22be3c955ac49da2e2107b67a",
+);
+
+$failed = 0;
+foreach (sort(keys(%data)))
+{
+ $md5->reset;
+ $md5->add($_);
+ $digest = $md5->digest;
+ $hex = unpack("H*", $digest);
+ if ($hex ne $data{$_}) {
+ print STDERR "\$md5->digest: $_\n";
+ print STDERR "expected: $data{$_}\n",
+ "got : $hex\n";
+ $failed++;
+ }
+
+ if (Digest::MD5::md5($_) ne $digest) {
+ print STDERR "md5($_) failed\n";
+ $failed++;
+ }
+
+ if (Digest::MD5::md5_hex($_) ne $hex) {
+ print STDERR "md5_hex($_) failed\n";
+ $failed++;
+ }
+
+ # same stuff ending with $md5->hexdigest instead
+ $md5->reset;
+ $md5->add($_);
+ $hex = $md5->hexdigest;
+ if ($hex ne $data{$_}) {
+ print STDERR "\$md5->hexdigest: $_\n";
+ print STDERR "expected: $data{$_}\n",
+ "got : $hex\n";
+ $failed++;
+ }
+}
+print ($failed ? "not ok 3\n" : "ok 3\n");
+
+# 4: Various flavours of file-handle to addfile
+
+open(F, "<$0");
+
+$md5->reset;
+
+$md5->addfile(F);
+$hex = $md5->hexdigest;
+print ($hex ne '' ? "ok 4\n" : "not ok 4\n");
+
+$orig = $hex;
+
+# 5: Fully qualified with ' operator
+
+seek(F, 0, 0);
+$md5->reset;
+$md5->addfile(MD5Test'F);
+$hex = $md5->hexdigest;
+print ($hex eq $orig ? "ok 5\n" : "not ok 5\n");
+
+# 6: Fully qualified with :: operator
+
+seek(F, 0, 0);
+$md5->reset;
+$md5->addfile(MD5Test::F);
+$hex = $md5->hexdigest;
+print ($hex eq $orig ? "ok 6\n" : "not ok 6\n");
+
+# 7: Type glob
+
+seek(F, 0, 0);
+$md5->reset;
+$md5->addfile(*F);
+$hex = $md5->hexdigest;
+print ($hex eq $orig ? "ok 7\n" : "not ok 7\n");
+
+# 8: Type glob reference (the prefered mechanism)
+
+seek(F, 0, 0);
+$md5->reset;
+$md5->addfile(\*F);
+$hex = $md5->hexdigest;
+print ($hex eq $orig ? "ok 8\n" : "not ok 8\n");
+
+# 9: File-handle passed by name (really the same as 6)
+
+seek(F, 0, 0);
+$md5->reset;
+$md5->addfile("MD5Test::F");
+$hex = $md5->hexdigest;
+print ($hex eq $orig ? "ok 9\n" : "not ok 9\n");
+
+# 10: Other ways of reading the data -- line at a time
+
+seek(F, 0, 0);
+$md5->reset;
+while (<F>)
+{
+ $md5->add($_);
+}
+$hex = $md5->hexdigest;
+print ($hex eq $orig ? "ok 10\n" : "not ok 10\n");
+
+# 11: Input lines as a list to add()
+
+seek(F, 0, 0);
+$md5->reset;
+$md5->add(<F>);
+$hex = $md5->hexdigest;
+print ($hex eq $orig ? "ok 11\n" : "not ok 11\n");
+
+# 12: Random chunks up to 128 bytes
+
+seek(F, 0, 0);
+$md5->reset;
+while (read(F, $hexata, (rand % 128) + 1))
+{
+ $md5->add($hexata);
+}
+$hex = $md5->hexdigest;
+print ($hex eq $orig ? "ok 12\n" : "not ok 12\n");
+
+# 13: All the data at once
+
+seek(F, 0, 0);
+$md5->reset;
+undef $/;
+$data = <F>;
+$hex = $md5->hexhash($data);
+print ($hex eq $orig ? "ok 13\n" : "not ok 13\n");
+
+close(F);
+
+# 14: Using static member function
+
+$hex = MD5->hexhash($data);
+print ($hex eq $orig ? "ok 14\n" : "not ok 14\n");
More information about the Pkg-perl-cvs-commits
mailing list