|
| getSupportedAlgorithms () |
| Return the list of hashing algorithms supported by this server. More...
|
|
| getBestAlgorithm () |
| Return the best hashing algorithm supported by this server. More...
|
|
| getCurrentlySelectedAlgorithm () |
| Return the currently selected hashing algorithm. More...
|
|
| getWorkFactor () |
| Return the currently configured work factor for bcrypt and other adjustable algorithms. More...
|
|
| createHash ($password, $algorithm=null) |
| Create a hash using the specified algorithm. More...
|
|
| checkPassword ($password, $hash, $algorithm=null) |
| Check if a password matches a hash. More...
|
|
| checkAlgorithm ($hash) |
| Check the algorithm used to create a hash. More...
|
|
| checkWorkFactor ($hash) |
| Check the work factor of a hash. More...
|
|
| createSecureSalt ($length, $format= 'hex') |
| Generate a cryptographically secure random string to use as a salt. More...
|
|
| createTemporaryPassword ($length=16) |
| Generate a temporary password using the secure salt generator. More...
|
|
| pbkdf2 ($password, $salt, $algorithm= 'sha256', $iterations=8192, $length=24) |
| Generate the PBKDF2 hash of a string using a salt. More...
|
|
| bcrypt ($password, $salt=null) |
| Generate the bcrypt hash of a string using a salt. More...
|
|
| strcmpConstantTime ($a, $b) |
| Compare two strings in constant time. More...
|
|
Definition at line 13 of file Password.class.php.
Password::bcrypt |
( |
|
$password, |
|
|
|
$salt = null |
|
) |
| |
Generate the bcrypt hash of a string using a salt.
- Parameters
-
string | $password | The password |
string | $salt | The salt (optional, auto-generated if empty) |
- Returns
- string
Definition at line 418 of file Password.class.php.
Password::checkAlgorithm |
( |
|
$hash | ) |
|
Check the algorithm used to create a hash.
- Parameters
-
- Returns
- string
Definition at line 174 of file Password.class.php.
Password::checkPassword |
( |
|
$password, |
|
|
|
$hash, |
|
|
|
$algorithm = null |
|
) |
| |
Check if a password matches a hash.
- Parameters
-
string | $password | The password |
string | $hash | The hash |
string | $algorithm | The algorithm (optional) |
- Returns
- bool
Definition at line 133 of file Password.class.php.
static Password::checkSignature |
( |
|
$string, |
|
|
|
$signature |
|
) |
| |
|
static |
Check whether a signature is valid.
- Parameters
-
string | $string | |
string | $signature | |
- Returns
- bool
Definition at line 349 of file Password.class.php.
Password::checkWorkFactor |
( |
|
$hash | ) |
|
Check the work factor of a hash.
- Parameters
-
- Returns
- int
Definition at line 207 of file Password.class.php.
Password::createHash |
( |
|
$password, |
|
|
|
$algorithm = null |
|
) |
| |
Create a hash using the specified algorithm.
- Parameters
-
string | $password | The password |
string | $algorithm | The algorithm (optional) |
- Returns
- string
Definition at line 94 of file Password.class.php.
Password::createSecureSalt |
( |
|
$length, |
|
|
|
$format = 'hex' |
|
) |
| |
Generate a cryptographically secure random string to use as a salt.
- Parameters
-
int | $length | The number of bytes to return |
string | $format | hex or alnum |
- Returns
- string
Definition at line 229 of file Password.class.php.
static Password::createSignature |
( |
|
$string | ) |
|
|
static |
Create a digital signature to verify the authenticity of a string.
- Parameters
-
- Returns
- string
Definition at line 335 of file Password.class.php.
Password::createTemporaryPassword |
( |
|
$length = 16 | ) |
|
Generate a temporary password using the secure salt generator.
- Parameters
-
int | $length | The number of bytes to return |
- Returns
- string
Definition at line 311 of file Password.class.php.
Password::getBestAlgorithm |
( |
| ) |
|
Return the best hashing algorithm supported by this server.
- Returns
- string
Definition at line 38 of file Password.class.php.
Password::getCurrentlySelectedAlgorithm |
( |
| ) |
|
Return the currently selected hashing algorithm.
- Returns
- string
Definition at line 48 of file Password.class.php.
static Password::getSecretKey |
( |
| ) |
|
|
static |
Password::getSupportedAlgorithms |
( |
| ) |
|
Return the list of hashing algorithms supported by this server.
- Returns
- array
Definition at line 19 of file Password.class.php.
Password::getWorkFactor |
( |
| ) |
|
Return the currently configured work factor for bcrypt and other adjustable algorithms.
- Returns
- int
Definition at line 70 of file Password.class.php.
Password::pbkdf2 |
( |
|
$password, |
|
|
|
$salt, |
|
|
|
$algorithm = 'sha256' , |
|
|
|
$iterations = 8192 , |
|
|
|
$length = 24 |
|
) |
| |
Generate the PBKDF2 hash of a string using a salt.
- Parameters
-
string | $password | The password |
string | $salt | The salt |
string | $algorithm | The algorithm (optional, default is sha256) |
int | $iterations | Iteration count (optional, default is 8192) |
int | $length | The length of the hash (optional, default is 32) |
- Returns
- string
Definition at line 388 of file Password.class.php.
Password::strcmpConstantTime |
( |
|
$a, |
|
|
|
$b |
|
) |
| |
Compare two strings in constant time.
- Parameters
-
string | $a | The first string |
string | $b | The second string |
- Returns
- bool
Definition at line 433 of file Password.class.php.
The documentation for this class was generated from the following file: