class manager

Properties

protected $type

Default hashing method

protected $type_map

Hashing algorithm type map Will be used to map hash prefix to type

$algorithms

Service collection of hashing algorithms Needs to be public for passwords helper

$convert_flag

Password convert flag. Signals that password should be converted

protected helper $helper

Passwords helper

protected config $config

phpBB configuration

Methods

__construct(config $config, array $hashing_algorithms, helper $helper, array $defaults)

Construct a passwords object

initialize()

Initialize the internal state

register_default_type(array $defaults)

Register default type Will register the first supported type from the list of default types

fill_type_map(service_collection $hashing_algorithms)

Fill algorithm type map

object|bool
get_algorithm(string $prefix)

Get the algorithm specified by a specific prefix

object|bool
detect_algorithm(string $hash)

Detect the hash type of the supplied hash

string|bool
hash(string $password, string $type = '')

Hash supplied password

string|bool
check(string $password, string $hash, array $user_row = array())

Check supplied password against hash and set convert_flag if password needs to be converted to different format (preferably newer one)

string|bool
combined_hash_password(string $password_hash, array $type)

Create combined hash from already hashed password

bool
check_combined_hash(string $password, array $stored_hash_type, string $hash, bool $skip_phpbb2_check = false)

Check combined password hash against the supplied password

Details

at line 75
__construct(config $config, array $hashing_algorithms, helper $helper, array $defaults)

Construct a passwords object

Parameters

config $config

phpBB configuration

array $hashing_algorithms

Hashing driver service collection

helper $helper

Passwords helper object

array $defaults

List of default driver types

at line 86
protected initialize()

Initialize the internal state

at line 103
protected register_default_type(array $defaults)

Register default type Will register the first supported type from the list of default types

Parameters

array $defaults

List of default types in order from first to use to last to use

at line 120
protected fill_type_map(service_collection $hashing_algorithms)

Fill algorithm type map

Parameters

service_collection $hashing_algorithms

at line 140
protected object|bool get_algorithm(string $prefix)

Get the algorithm specified by a specific prefix

Parameters

string $prefix

Password hash prefix

Return Value

object|bool

The hash type object or false if prefix is not supported

at line 160
object|bool detect_algorithm(string $hash)

Detect the hash type of the supplied hash

Parameters

string $hash

Password hash that should be checked

Return Value

object|bool

The hash type object or false if the specified type is not supported

at line 214
string|bool hash(string $password, string $type = '')

Hash supplied password

Parameters

string $password

Password that should be hashed

string $type

Hash type. Will default to standard hash type if none is supplied

Return Value

string|bool

Password hash of supplied password or false if if something went wrong during hashing

at line 260
string|bool check(string $password, string $hash, array $user_row = array())

Check supplied password against hash and set convert_flag if password needs to be converted to different format (preferably newer one)

Parameters

string $password

Password that should be checked

string $hash

Stored hash

array $user_row

User's row in users table

Return Value

string|bool

True if password is correct, false if not

at line 337
string|bool combined_hash_password(string $password_hash, array $type)

Create combined hash from already hashed password

Parameters

string $password_hash

Complete current password hash

array $type

Type of the hashing algorithm the password hash should be combined with

Return Value

string|bool

Combined password hash if combined hashing was successful, else false

at line 389
bool check_combined_hash(string $password, array $stored_hash_type, string $hash, bool $skip_phpbb2_check = false)

Check combined password hash against the supplied password

Parameters

string $password

Password entered by user

array $stored_hash_type

An array containing the hash types as described by stored password hash

string $hash

Stored password hash

bool $skip_phpbb2_check

True if phpBB2 password check should be skipped

Return Value

bool

True if password is correct, false if not