Hi,
I'm trying to encrypt a password using the same method as WordPress (MD5()).
The PHP code used to encrypt the passwords, is;
$wpdb->query("UPDATE $wpdb->users SET user_pass = MD5('$new_pass'), user_activation_key = '' WHERE user_login = '$user->user_login'");
From the looks of things, thats usings PHP's built in MD5() function. However, I obviously can't use that in a Perl script.
Having a look at the help page on php.net (http://uk.php.net/...nction.md5.php#31238)
md5($data,...)
This function will concatenate all arguments, calculate the MD5 digest of this "message", and return it in binary form.
md5_hex($data,...)
Same as md5(), but will return the digest in hexadecimal form.
PHP's function returns the digest in hexadecimal form, so my guess is that you're using md5() instead of md5_hex(). I have verified that md5_hex() generates the same string as PHP's md5() function.
(original comment snipped in various places)
>Hexidecimal hashes generated with Perl's Digest::MD5 module WILL
>NOT equal hashes generated with php's md5() function if the input
>text contains any non-alphanumeric characters.
>
>$phphash = md5('pa$$');
>echo "php original hash from text: $phphash";
>echo "md5 hash from perl: " . $myrow['password'];
>
>outputs:
>
>php original hash from text: 0aed5d740d7fab4201e885019a36eace
>hash from perl: c18c9c57cb3658a50de06491a70b75cd
So in short.. how on earth can I create the same kind of MD5 string in Perl?
Basically, I need to encrypt it in Perl.. and put it in the same table as WordPress uses (which is using the MD5) encryption method). Really got my mind boggled
Cheers
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
I'm trying to encrypt a password using the same method as WordPress (MD5()).
The PHP code used to encrypt the passwords, is;
$wpdb->query("UPDATE $wpdb->users SET user_pass = MD5('$new_pass'), user_activation_key = '' WHERE user_login = '$user->user_login'");
From the looks of things, thats usings PHP's built in MD5() function. However, I obviously can't use that in a Perl script.
Having a look at the help page on php.net (http://uk.php.net/...nction.md5.php#31238)
Quote:
From the documentation on Digest::MD5: md5($data,...)
This function will concatenate all arguments, calculate the MD5 digest of this "message", and return it in binary form.
md5_hex($data,...)
Same as md5(), but will return the digest in hexadecimal form.
PHP's function returns the digest in hexadecimal form, so my guess is that you're using md5() instead of md5_hex(). I have verified that md5_hex() generates the same string as PHP's md5() function.
(original comment snipped in various places)
>Hexidecimal hashes generated with Perl's Digest::MD5 module WILL
>NOT equal hashes generated with php's md5() function if the input
>text contains any non-alphanumeric characters.
>
>$phphash = md5('pa$$');
>echo "php original hash from text: $phphash";
>echo "md5 hash from perl: " . $myrow['password'];
>
>outputs:
>
>php original hash from text: 0aed5d740d7fab4201e885019a36eace
>hash from perl: c18c9c57cb3658a50de06491a70b75cd
So in short.. how on earth can I create the same kind of MD5 string in Perl?
Basically, I need to encrypt it in Perl.. and put it in the same table as WordPress uses (which is using the MD5) encryption method). Really got my mind boggled

Cheers
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!