package BackPress

 Methods

Checks the plaintext password against the encrypted Password.

check_password(string $password, string $hash, $user_id = '') : boolean

Maintains compatibility between old version and the new cookie authentication protocol using PHPass library. The $hash parameter is the encrypted password and the function compares the plain text password when encypted similarly against the already encrypted password to see if they match.

For integration with other applications, this function can be overwritten to instead use the other package password checking algorithm.

since WP 2.5
global object $wp_hasher PHPass object used for checking the password against the $hash + $password
uses

Parameters

$password

string

Plaintext user's password

$hash

string

Hash of the user's password to check against.

$user_id

Returns

booleanFalse, if the $password does not match the hashed password

Generates a random password drawn from the defined set of characters

generate_password(integer $length = 12, boolean $special_chars = true) : string
since WP 2.5

Parameters

$length

integer

The length of password to generate

$special_chars

boolean

Whether to include standard special characters

Returns

stringThe random password

Create a hash (encrypt) of a plain text password.

hash_password(string $password) : string

For integration with other applications, this function can be overwritten to instead use the other package password checking algorithm.

since WP 2.5
global object $wp_hasher PHPass object
uses

Parameters

$password

string

Plain text user password to hash

Returns

stringThe hash string of the password

Generates a random number

rand(integer $min = 0, integer $max = 0) : integer

Not verbatim WordPress, keeps seed value in backpress options.

since WP 2.6.2

Parameters

$min

integer

Lower limit for the generated number (optional, default is 0)

$max

integer

Upper limit for the generated number (optional, default is 4294967295)

Returns

integerA random number between min and max