in reply to Verify WordPress user password via Perl

I was looking for this exact same thing. Honestly, I do not like the solutions that require CGI calls or invoking php to do this. Therefore, I found a way to do this entirely in perl using the Authen::Passphrase::PHPass module. Very quickly, the idea when using this module is to pass into the module a copy of the existing hashed password from user_pass from the user you want to verify the password for. The reason you do this is because encoded in the hashed password are some parameters you need to verify with, such as the salt, and the 'cost' value used by the Authen::Passphrase::PHPass module. So, the following should work:
sub verify_wordpress_pass { my ($wordpress_hashed_pw, $passphrase) = @_; use Authen::Passphrase::PHPass; my $ppr = Authen::Passphrase::PHPass->from_crypt($wordpress_hashed +_pw); # Note, $passphrase is the unencrypted password you want to verify return $ppr->match($passphrase); # Returns 1 if matched, undef if +failed }
If you want to check manually, you can also print a copy of the hashed password; also useful for generating a new password, from perl:
sub print_wordpress_pass { my ($wordpress_hashed_pw, $passphrase) = @_; use Authen::Passphrase::PHPass; my $ppr = Authen::Passphrase::PHPass->from_crypt($wordpress_hashed +_pw); # Note, $passphrase is the unencrypted password you want to verify my $set_ppr = Authen::Passphrase::PHPass->new( cost => $ppr->cost, salt => $ppr->salt, passphrase => $passphrase ); print $wordpress_hashed_pw . "\n" . $set_ppr->as_crypt . "\n"; }
I know this thread is old, but this topic may not be and this is the only thread I've seen it addressed. I hope it helps someone else out.