in reply to Verify WordPress user password via Perl
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 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 }
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.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"; }
|
|---|