Using wordpress user password algorithm rules to modify user passwords

Source: Internet
Author: User

The wordpress user password is saved in the User_pass field of the Wp_users data table, and the password is generated by portable the PHP password hashing framework class.

The form of the password is random and irreversible, the same plaintext password at different times, the resulting ciphertext is not the same, relatively safe.

WordPress User Password generation process is: when the need to generate a user password, randomly generated a salt, and then add the salt and password, and count the number of times MD5, the last and encode64 the hash of the value of the cumulative, you get a $p$ The beginning of the password, this password every time the result is different, the following is the code that generates the WordPress password, put it in the WordPress root directory, you can generate an encrypted password, with this password to replace the Wp_users data table User_ Pass field to change the password.

<?php
Require_once ('./wp-includes/class-phpass.php ');     $password = ' AAA '; $WP _hasher = new PasswordHash (8, TRUE); echo $wp _hasher->hashpassword ($password);

This library can be used in its own program, check whether the password is successful with another function Checkpassword ($password, $stored _hash), the first is clear, the 2nd parameter is the password previously encrypted

require_once ('./wp-includes/class-phpass.php ');
//Original Password$passwordValue= "123456";//Generate password$WP _hasher=NewPasswordHash (8,TRUE);$sigPassword=$WP _hasher->hashpassword ($passwordValue);Echo"The generated password is:".$sigPassword;Echo"\ n";//Verify Password$data=$WP _hasher->checkpassword ($passwordValue,$sigPassword);if($data){Echo' Password correct ';}Else{Echo' Password error ';}

Using wordpress user password algorithm rules to modify user passwords

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.