Documentation

Auth
in package

Provides user authentication functions for the admin

Table of Contents

Methods

checkAlgorithm()  : bool
Checks if a given password algorithm is available
defaultAlgorithm()  : int
Return the algorithm for new accounts.
doPasswordCheck()  : bool
Check a password hash against an entered password
hashPassword()  : array<string|int, mixed>|null
Return a hashed password, password algorithm, and salt, for inserting into the database

Methods

checkAlgorithm()

Checks if a given password algorithm is available

public static checkAlgorithm(int $algorithm) : bool
Parameters
$algorithm : int

Password algorithm, Constants

Return values
bool —

True if the specified algorithm is available, False otherwise

defaultAlgorithm()

Return the algorithm for new accounts.

public static defaultAlgorithm() : int

Existing accounts will be re-crypted into this algorithm upon next login.

Return values
int —

Password algorithm, Constants

doPasswordCheck()

Check a password hash against an entered password

public static doPasswordCheck(string $known_hash, int $algorithm, string $salt, string $user_string) : bool
Parameters
$known_hash : string

The known hash to check against, typically from the database

$algorithm : int

Password algorithm, Constants

$salt : string
$user_string : string

Password which was entered by the user, to check against the stored hash

Return values
bool —

True if the password matches, false if it doesn't

hashPassword()

Return a hashed password, password algorithm, and salt, for inserting into the database

public static hashPassword(string $password[, int $algorithm = null ]) : array<string|int, mixed>|null
Parameters
$password : string

Plaintext password

$algorithm : int = null

Password algorithm, Constants. If not specified, the default is used.

Return values
array<string|int, mixed>|null —

0 => hash, 1 => algorithm, 2 => salt

On this page

Search results