wp_password_needs_rehash( string $hash )

Checks whether a password hash needs to be rehashed.


Description

Passwords are hashed with bcrypt using the default cost. A password hashed in a prior version of WordPress may still be hashed with phpass and will need to be rehashed. If the default cost or algorithm is changed in PHP or WordPress then a password hashed in a previous version will need to be rehashed.


Parameters

$hash

(Required) Hash of a password to check.


Return

(bool) Whether the hash needs to be rehashed.


Source

File: wp-includes/pluggable.php

	function wp_password_needs_rehash( $hash ) {
		global $wp_hasher;

		if ( ! empty( $wp_hasher ) ) {
			return false;
		}

		/*
		 * Function cp_hash_password_options() is documented in wp-includes/user.php
		 */
		$options = cp_hash_password_options();

		return password_needs_rehash( $hash, PASSWORD_DEFAULT, $options );
	}

Changelog

Changelog
Version Description
CP-2.3.0 Introduced. CP-2.3.0