On Wed, 26 Mar 2003 17:23:33 +0100, you wrote:

>Im Very Sorry / Embarrased.. my code example had a mistake with extra
>linebreak. Here is the example with out it, which gives a different MD5
>hash.

I don't know why this is, but if you call Digest::MD5->md5_hex() in a
procedural rather than OO way, it works.  I changed your perl to the
following:

#!/usr/local/bin/perl
use strict;
use Digest::MD5 qw(md5_hex);

my $to_be_hashed = "Cheese";
#my ($hash) = Digest::MD5->md5_hex($to_be_hashed);
my ($hash) = md5_hex($to_be_hashed);
print "to_be_hashed : '$to_be_hashed' <P>\n";
print "hash : '$hash' <P>\n";

And now it prints the same digest that the PHP version does:

to_be_hashed : 'Cheese' <P>
hash : 'a67778b3dcc82bfaace0f8bc0061f20e' <P>

HTH...

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to