Password
in package
Leaf Password Helper --------------------------------------------- Work easier and faster with passwords
Tags
Table of Contents
Constants
Properties
- $spice : mixed
Methods
- argon2() : mixed
- Generate an Argon2 hashed password
- argon2Verify() : mixed
- Checks if the given argon2 hash matches the given options.
- bcrypt() : mixed
- Generate an Argon2 hashed password
- bcryptVerify() : mixed
- Checks if the given BCRYPT hash matches the given options.
- hash() : mixed
- Create a password hash
- spice() : mixed
- Get or set password 'spice'
- verify() : mixed
- Checks if the given hash matches the given options.
Constants
ARGON2
public
mixed
ARGON2
= PASSWORD_ARGON2I
BCRYPT
public
mixed
BCRYPT
= PASSWORD_BCRYPT
DEFAULT
public
mixed
DEFAULT
= PASSWORD_DEFAULT
MD5
public
mixed
MD5
= "md5"
Properties
$spice
protected
static mixed
$spice
= null
Methods
argon2()
Generate an Argon2 hashed password
public
static argon2(string $password[, array<string|int, mixed> $options = [] ]) : mixed
Parameters
- $password : string
-
The user's password to hash
- $options : array<string|int, mixed> = []
-
Options for Argon hash
Supported Options:
- memory_cost (integer) - Maximum memory (in bytes) that may be used to compute the Argon2 hash. Defaults to PASSWORD_ARGON2_DEFAULT_MEMORY_COST.
- time_cost (integer) - Maximum amount of time it may take to compute the Argon2 hash. Defaults to PASSWORD_ARGON2_DEFAULT_TIME_COST.
- threads (integer) - Number of threads to use for computing the Argon2 hash. Defaults to PASSWORD_ARGON2_DEFAULT_THREADS.
Available as of PHP 7.2.0.
argon2Verify()
Checks if the given argon2 hash matches the given options.
public
static argon2Verify(string $password, string $hashedPassword) : mixed
Parameters
- $password : string
- $hashedPassword : string
bcrypt()
Generate an Argon2 hashed password
public
static bcrypt(string $password[, array<string|int, mixed> $options = [] ]) : mixed
Parameters
- $password : string
-
The user's password to hash
- $options : array<string|int, mixed> = []
-
Options for Argon hash
bcryptVerify()
Checks if the given BCRYPT hash matches the given options.
public
static bcryptVerify(string $password, string $hashedPassword) : mixed
Parameters
- $password : string
- $hashedPassword : string
hash()
Create a password hash
public
static hash(string $password[, mixed $algorithm = self::DEFAULT ][, array<string|int, mixed> $options = [] ]) : mixed
See the password algorithm constants for documentation on the supported options for each algorithm.
Parameters
- $password : string
- $algorithm : mixed = self::DEFAULT
- $options : array<string|int, mixed> = []
spice()
Get or set password 'spice'
public
static spice([mixed $spice = null ]) : mixed
Parameters
- $spice : mixed = null
verify()
Checks if the given hash matches the given options.
public
static verify(string $password, mixed $hashedPassword) : mixed
Parameters
- $password : string
- $hashedPassword : mixed