Link to home
Start Free TrialLog in
Avatar of intechfs
intechfsFlag for United Kingdom of Great Britain and Northern Ireland

asked on

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

Avatar of zer0se7en
zer0se7en
Flag of Moldova, Republic of image

Use MD5 or SHA256 hash.
Avatar of intechfs

ASKER

I have already written a large amount of code relying on whirlpool and would like to continue using it.
ASKER CERTIFIED SOLUTION
Avatar of zer0se7en
zer0se7en
Flag of Moldova, Republic of image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for that.

The problem was actually elsewhere in the code but testing that helped me find it.