modulespage-login.php

Functions

do_password_hash_code_update()

do_password_hash_code_update() 

Recalculates and updates the password hashing cost.

hash_password_properties()

hash_password_properties() : array

Figures out the appropriate algorithm & options for hashing passwords based on the current settings.

Returns

array —

The appropriate password hashing algorithm and options.

hash_password()

hash_password(string  $pass) : string

Hashes the given password according to the current settings defined in $settings.

Parameters

string $pass

The password to hash.

Returns

string —

The hashed password. Uses sha3 if $settings->use_sha3 is enabled, or sha256 otherwise.

verify_password()

verify_password(string  $pass, string  $hash) : boolean

Verifies a user's password against a pre-generated hash.

Parameters

string $pass

The user's password.

string $hash

The hash to compare against.

Returns

boolean —

Whether the password matches the has or not.

hash_password_update()

hash_password_update(string  $pass, string  $hash) : string|null

Determines if the provided password needs re-hashing or not.

Parameters

string $pass

The password to check.

string $hash

The hash of the provided password to check.

Returns

string|null —

Returns null if an updaste is not required - otherwise returns the new updated hash.

hash_password_compute_cost()

hash_password_compute_cost(  $verbose = false) : integer

Computes the appropriate cost value for password_hash based on the settings automatically.

Starts at 10 and works upwards in increments of 1. Goes on until a value is found that's greater than the target - or 10x the target time elapses.

Parameters

$verbose

Returns

integer —

The automatically calculated password hashing cost.