PHP and Perl different Whirlpool hashes

I have a user password that is hashed using Whirlpool in PHP to check it matches the password stored in the database.

The code to do this is below.

I have the same user password that is hashed using Whirlpool in Perl to check it matches the password stored in the database.

The code to do this is also below.

The problem I have is that the PHP and the Perl string are always different despite the original passwords being identical.

Can someone please tell me why this is and how I can get them both to return the same hash.
PHP:
$v_salted_password = hash ( 'whirlpool' , $v_password );
 
PERL:
my $whirlCrypt = Digest -> new( 'Whirlpool' );
$whirlCrypt -> add( $uPwd );
$uPwd = $whirlCrypt -> hexdigest;

Open in new window

intechfsAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

zer0se7enCommented:
Use MD5 or SHA256 hash.
0
intechfsAuthor Commented:
I have already written a large amount of code relying on whirlpool and would like to continue using it.
0
zer0se7enCommented:
There are a few versions of Whirlpool (Whirlpool-0, Whirlpool-T, Whirlpool).
1. Assure u use the same version in PHP and Perl (u may use the http://en.wikipedia.org/wiki/Whirlpool_(cryptography) article - there are the hashes of the "quick fox...." sentence in all tree implementations.
2. Assure u have the exactly same binary representations of the string in php and perl environments (use base64 to compare the password representations)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
intechfsAuthor Commented:
Thanks for that.

The problem was actually elsewhere in the code but testing that helped me find it.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Perl

From novice to tech pro — start learning today.