mirror of
https://github.com/danog/endtoend-test-psl.git
synced 2024-11-26 20:34:59 +01:00
[Password] mark password functions pure
This commit is contained in:
parent
edb2c8c501
commit
3c96b7624e
@ -8,6 +8,8 @@ namespace Psl\Password;
|
||||
* Return a complete list of all registered password hashing algorithms.
|
||||
*
|
||||
* @psalm-return list<string>
|
||||
*
|
||||
* @psalm-pure
|
||||
*/
|
||||
function algorithms(): array
|
||||
{
|
||||
|
@ -18,6 +18,8 @@ use function password_get_info;
|
||||
* algorithm: string,
|
||||
* options: array{cost: int}|array{memory_cost: int, time_cost: int, threads: int}
|
||||
* }
|
||||
*
|
||||
* @psalm-pure
|
||||
*/
|
||||
function get_information(string $hash): array
|
||||
{
|
||||
|
@ -26,6 +26,8 @@ use const PASSWORD_BCRYPT;
|
||||
* @see ARGON2I_ALGORITHM for the argon2i, and argon2id supported options.
|
||||
*
|
||||
* @throws Psl\Exception\InvariantViolationException The given algorithm is unsupported.
|
||||
*
|
||||
* @psalm-pure
|
||||
*/
|
||||
function hash(string $password, string $algorithm = DEFAULT_ALGORITHM, array $options = []): string
|
||||
{
|
||||
|
@ -19,6 +19,8 @@ use function password_needs_rehash;
|
||||
* This function is safe against timing attacks.
|
||||
*
|
||||
* @psalm-param array{cost?: int}|array{memory_cost?: int, time_cost?: int, threads?: int} $options
|
||||
*
|
||||
* @psalm-pure
|
||||
*/
|
||||
function needs_rehash(string $hash, string $algorithm = DEFAULT_ALGORITHM, array $options = []): bool
|
||||
{
|
||||
|
@ -8,6 +8,8 @@ use function password_verify;
|
||||
|
||||
/**
|
||||
* Checks if the given hash matches the given options.
|
||||
*
|
||||
* @psalm-pure
|
||||
*/
|
||||
function verify(string $password, string $hash): bool
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user