Click here to get back home

php and perl md5

 HomeNewsGroups | Search | About
 comp.lang.php    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
php and perl md5 jason m 06-12-2008
  `--> Re: php and perl md5 C. (http://symc...06-13-2008
Get Chitika Premium
Posted by jason m on June 12, 2008, 9:45 pm
Please log in for more thread options
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.


Posted by Jerry Stuckle on June 12, 2008, 10:54 pm
Please log in for more thread options
jason m wrote:
> 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
==================


Posted by C. (http://symcbean.blogspot.c on June 13, 2008, 8:00 am
Please log in for more thread options
> jason m wrote:
> > 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>
>
> 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.

> > 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.

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.

Similar ThreadsPosted
2>&1 arg in exec(perl.... + "sh: /perl not found error" TIA for help December 6, 2005, 7:14 pm
Perl vs PHP? June 5, 2005, 12:49 am
Perl-1.0.0 July 7, 2006, 6:30 am
PHP v PERL October 21, 2006, 1:22 pm
php and perl June 12, 2007, 7:19 am
Why PHP instead of Perl? June 21, 2007, 9:53 pm
perl cgi vs php January 21, 2008, 4:20 pm
Is PHP still slower than Perl? October 2, 2004, 4:56 am
perl style in php ? October 31, 2004, 8:59 am
perl-like "slurp" in PHP? December 22, 2004, 11:46 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap