+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
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;
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.
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
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.
-/* $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
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:
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.
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
}