summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2003-01-17 19:45:11 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2003-01-17 19:45:11 +0000
commitf62a1bde2a73540d6afdf31aee368004fb1346f0 (patch)
tree7aee8edd0c14301243a7873cade22511e836a5da /ext
parent7bdbfeb78e66fc69fec82d24f7aedd5221926707 (diff)
downloadperl-f62a1bde2a73540d6afdf31aee368004fb1346f0.tar.gz
Upgrade to Digest::MD5 2.22.
p4raw-id: //depot/perl@18509
Diffstat (limited to 'ext')
-rw-r--r--ext/Digest/MD5/Changes9
-rw-r--r--ext/Digest/MD5/MD5.pm15
-rw-r--r--ext/Digest/MD5/MD5.xs18
-rw-r--r--ext/Digest/MD5/README2
-rw-r--r--ext/Digest/MD5/t/files.t24
5 files changed, 51 insertions, 17 deletions
diff --git a/ext/Digest/MD5/Changes b/ext/Digest/MD5/Changes
index 2500b89d50..2c113b41b7 100644
--- a/ext/Digest/MD5/Changes
+++ b/ext/Digest/MD5/Changes
@@ -1,3 +1,12 @@
+2002-03-04 Gisle Aas <gisle@ActiveState.com>
+
+ Release 2.22.
+
+ Added clone method.
+ Contributed by Holger Smolinski <holger@kunterbunt.bb.bawue.de>
+
+
+
2002-12-27 Gisle Aas <gisle@ActiveState.com>
Release 2.21
diff --git a/ext/Digest/MD5/MD5.pm b/ext/Digest/MD5/MD5.pm
index 08e616e67b..0017e5af56 100644
--- a/ext/Digest/MD5/MD5.pm
+++ b/ext/Digest/MD5/MD5.pm
@@ -3,7 +3,7 @@ package Digest::MD5;
use strict;
use vars qw($VERSION @ISA @EXPORT_OK);
-$VERSION = '2.21'; # $Date: 2002/12/28 05:30:03 $
+$VERSION = '2.22'; # $Date: 2003/01/05 00:56:14 $
require Exporter;
*import = \&Exporter::import;
@@ -117,6 +117,14 @@ If called as an instance method (i.e. $md5->new) it will just reset the
state the object to the state of a newly created object. No new
object is created in this case.
+=item $md5->clone
+
+This is a copy constructor returning a clone of the $md5 object. It is
+useful when you do not want to destroy the digests state, but need an
+intermediate value of the digest, e.g. when calculating digests
+iteratively on a continuous data stream in order to obtain a copy which
+may be destroyed.
+
=item $md5->reset
This is just an alias for $md5->new.
@@ -142,7 +150,8 @@ Return the binary digest for the message.
Note that the C<digest> operation is effectively a destructive,
read-once operation. Once it has been performed, the C<Digest::MD5>
object is automatically C<reset> and can be used to calculate another
-digest value.
+digest value. Call $md5->clone->digest if you want to calculate the
+digest without reseting the digest state.
=item $md5->hexdigest
@@ -253,7 +262,7 @@ RFC 1321
This library is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
- Copyright 1998-2002 Gisle Aas.
+ Copyright 1998-2003 Gisle Aas.
Copyright 1995-1996 Neil Winton.
Copyright 1991-1992 RSA Data Security, Inc.
diff --git a/ext/Digest/MD5/MD5.xs b/ext/Digest/MD5/MD5.xs
index 4a30550f5c..abc1748044 100644
--- a/ext/Digest/MD5/MD5.xs
+++ b/ext/Digest/MD5/MD5.xs
@@ -1,4 +1,4 @@
-/* $Id: MD5.xs,v 1.34 2002/05/01 23:30:28 gisle Exp $ */
+/* $Id: MD5.xs,v 1.35 2003/01/05 00:54:17 gisle Exp $ */
/*
* This library is free software; you can redistribute it and/or
@@ -562,6 +562,22 @@ new(xclass)
XSRETURN(1);
void
+clone(self)
+ SV* self
+ PREINIT:
+ MD5_CTX* cont = get_md5_ctx(self);
+ char *myname = sv_reftype(SvRV(self),TRUE);
+ MD5_CTX* context;
+ PPCODE:
+ STRLEN my_na;
+ New(55, context, 1, MD5_CTX);
+ ST(0) = sv_newmortal();
+ sv_setref_pv(ST(0), myname , (void*)context);
+ SvREADONLY_on(SvRV(ST(0)));
+ memcpy(context,cont,sizeof(MD5_CTX));
+ XSRETURN(1);
+
+void
DESTROY(context)
MD5_CTX* context
CODE:
diff --git a/ext/Digest/MD5/README b/ext/Digest/MD5/README
index 9ca422119f..d0297ecd60 100644
--- a/ext/Digest/MD5/README
+++ b/ext/Digest/MD5/README
@@ -6,7 +6,7 @@ MD5 is described in RFC 1321.
You will need perl version 5.004 or better to install this module.
-Copyright 1998-2002 Gisle Aas.
+Copyright 1998-2003 Gisle Aas.
Copyright 1995-1996 Neil Winton.
Copyright 1990-1992 RSA Data Security, Inc.
diff --git a/ext/Digest/MD5/t/files.t b/ext/Digest/MD5/t/files.t
index 073bada144..6351af525b 100644
--- a/ext/Digest/MD5/t/files.t
+++ b/ext/Digest/MD5/t/files.t
@@ -20,27 +20,27 @@ use Digest::MD5 qw(md5 md5_hex md5_base64);
my $EXPECT;
if (ord "A" == 193) { # EBCDIC
$EXPECT = <<EOT;
-36158997c99f2e1396ee40ddc4634a40 Changes
-5a591a47e8c40fe4b78c744111511c45 README
-770a5ef28ab15e66355639f21152afb0 MD5.pm
-4850753428db9422e8e5f97b401d5a13 MD5.xs
+ed8efe2e2dbab62fcc9dea2df6682569 Changes
+0565ec21b15c0f23f4c51fb327c8926d README
+0fcdd6d6e33b8772bd4b4832043035cd MD5.pm
+d7fd24455b9160aa8706635d15e6177e MD5.xs
276da0aa4e9a08b7fe09430c9c5690aa rfc1321.txt
EOT
} elsif ("\n" eq "\015") { # MacOS
$EXPECT = <<EOT;
-e68b13fe9edf36fe13551bf410b7a745 Changes
-3519f3d02c7c91158f732f0f00064657 README
-4113db8afad83eb7c01f1bf2c53e66ee MD5.pm
-1be293491bba726810f8e87671ee0328 MD5.xs
+2879619f967d5fc5a00ffe37b639f2ee Changes
+6c950a0211a5a28f023bb482037698cd README
+4e1043f0a7a266416d8408d6fa96f454 MD5.pm
+6bff95ff70ba43a6c81e255c6510a865 MD5.xs
754b9db19f79dbc4992f7166eb0f37ce rfc1321.txt
EOT
} else {
# This is the output of: 'md5sum Changes README MD5.pm MD5.xs rfc1321.txt'
$EXPECT = <<EOT;
-e68b13fe9edf36fe13551bf410b7a745 Changes
-3519f3d02c7c91158f732f0f00064657 README
-4113db8afad83eb7c01f1bf2c53e66ee MD5.pm
-1be293491bba726810f8e87671ee0328 MD5.xs
+2879619f967d5fc5a00ffe37b639f2ee Changes
+6c950a0211a5a28f023bb482037698cd README
+4e1043f0a7a266416d8408d6fa96f454 MD5.pm
+6bff95ff70ba43a6c81e255c6510a865 MD5.xs
754b9db19f79dbc4992f7166eb0f37ce rfc1321.txt
EOT
}