Connecting Tech Pros Worldwide Forums | Help | Site Map

php and perl md5

jason m
Guest
 
Posts: n/a
#1: Jun 27 '08
I am wondering how to translate this perl code to php. It seems the
md5 function is the same when using hexadecimal in perl but I'm not
sure what this md5->add code does.

Perl:
my $md5ShopPassString = Digest::MD5->new;
$md5ShopPassString->add("$ShopId");
$md5ShopPassString->add("$OrderId");
$ShopPassString = $md5ShopPassString->hexdigest;

PHP:
md5($ShopId . $OrderId);

These are not equal. Thanks in advance for any help.


Jerry Stuckle
Guest
 
Posts: n/a
#2: Jun 27 '08

re: php and perl md5


jason m wrote:
Quote:
I am wondering how to translate this perl code to php. It seems the
md5 function is the same when using hexadecimal in perl but I'm not
sure what this md5->add code does.
>
Perl:
my $md5ShopPassString = Digest::MD5->new;
$md5ShopPassString->add("$ShopId");
$md5ShopPassString->add("$OrderId");
$ShopPassString = $md5ShopPassString->hexdigest;
>
PHP:
md5($ShopId . $OrderId);
>
These are not equal. Thanks in advance for any help.
>
>
I'd suggest you find out what the md5->add function does before trying
to convert it. Try a perl newsgroup.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

C. (http://symcbean.blogspot.com/)
Guest
 
Posts: n/a
#3: Jun 27 '08

re: php and perl md5


On Jun 13, 3:54 am, Jerry Stuckle <jstuck...@attglobal.netwrote:
Quote:
jason m wrote:
Quote:
I am wondering how to translate this perl code to php. It seems the
md5 function is the same when using hexadecimal in perl but I'm not
sure what this md5->add code does.
>
<snip>
Quote:
>
I'd suggest you find out what the md5->add function does before trying
to convert it. Try a perl newsgroup.
>
Not suprisingly it concatenates it.
Quote:
Quote:
Perl:
my $md5ShopPassString = Digest::MD5->new;
$md5ShopPassString->add("$ShopId");
$md5ShopPassString->add("$OrderId");
$ShopPassString = $md5ShopPassString->hexdigest;
>
Quote:
PHP:
md5($ShopId . $OrderId);
>
Quote:
These are not equal. Thanks in advance for any help.
If they really aren't the same (you didn't provide examples) then try
using the Base64 method in Perl.
But as Jerry points out we're getting OT here.

C.
Closed Thread