Documentation

NativePasswordHasher
in package
implements PasswordHasherInterface Uses CheckPasswordLengthTrait

FinalYes

Hashes passwords using password_hash().

Tags
author

Elnur Abdurrakhimov elnur@elnur.pro

author

Terje Bråten terje@braten.be

author

Nicolas Grekas p@tchwork.com

Table of Contents

Interfaces

PasswordHasherInterface
Provides password hashing capabilities.

Properties

$algorithm  : string
$options  : array<string|int, mixed>

Methods

__construct()  : mixed
hash()  : string
Hashes a plain password.
needsRehash()  : bool
Checks if a password hash would benefit from rehashing.
verify()  : bool
Verifies a plain password against a hash.
isPasswordTooLong()  : bool

Properties

Methods

__construct()

public __construct([int $opsLimit = null ][, int $memLimit = null ][, int $cost = null ][, string|null $algorithm = null ]) : mixed
Parameters
$opsLimit : int = null
$memLimit : int = null
$cost : int = null
$algorithm : string|null = null

An algorithm supported by password_hash() or null to use the best available algorithm

hash()

Hashes a plain password.

public hash(string $plainPassword) : string
Parameters
$plainPassword : string
Return values
string

needsRehash()

Checks if a password hash would benefit from rehashing.

public needsRehash(string $hashedPassword) : bool
Parameters
$hashedPassword : string
Return values
bool

verify()

Verifies a plain password against a hash.

public verify(string $hashedPassword, string $plainPassword) : bool
Parameters
$hashedPassword : string
$plainPassword : string
Return values
bool

isPasswordTooLong()

private isPasswordTooLong(string $password) : bool
Parameters
$password : string
Return values
bool

        
On this page

Search results