How to create wordpress password hash generator using php?

Muyin picture Muyin · Jul 12, 2018 · Viewed 10.4k times · Source

I want to create WordPress password hash using PHP like www.passwordtool.hu.

An example:

Password: admin321

Wordpress Password Hash: $1$8HmCMIeg$qv9z585yftJa2Hxqo7/RB/

For testing purpose here is the tool Online Password Generator Tool: http://www.passwordtool.hu/wordpress-password-hash-generator-v3-v4

How to create this WordPress password using wordpress default functions?

Answer

Sudharshan Nair picture Sudharshan Nair · Jul 12, 2018

Wordpress provides a default function wp_hash_password();

Example:

$password = 'admin';
$hash_password = wp_hash_password($password);
echo $hash_password;

To work this in PHP just load wp-load.php, So that you can use default wordpress functions.

Wordpress actually use Portable PHP password hashing framework. WP has this included in /wp-includes/class-phpass.php