From: Jarkko Hietaniemi Date: Fri, 17 Jan 2003 19:45:11 +0000 (+0000) Subject: Upgrade to Digest::MD5 2.22. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f62a1bde2a73540d6afdf31aee368004fb1346f0;p=p5sagit%2Fp5-mst-13.2.git Upgrade to Digest::MD5 2.22. p4raw-id: //depot/perl@18509 --- diff --git a/ext/Digest/MD5/Changes b/ext/Digest/MD5/Changes index 2500b89..2c113b4 100644 --- a/ext/Digest/MD5/Changes +++ b/ext/Digest/MD5/Changes @@ -1,3 +1,12 @@ +2002-03-04 Gisle Aas + + Release 2.22. + + Added clone method. + Contributed by Holger Smolinski + + + 2002-12-27 Gisle Aas Release 2.21 diff --git a/ext/Digest/MD5/MD5.pm b/ext/Digest/MD5/MD5.pm index 08e616e..0017e5a 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 operation is effectively a destructive, read-once operation. Once it has been performed, the C object is automatically C 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 4a30550..abc1748 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 9ca4221..d0297ec 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 073bada..6351af5 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 = <