ApiOpenStudio PHPDoc

Hash
in package

Class Hash

Generate password and hash functions.

Table of Contents

$cost  : int
Iterations for hash.
generateHash()  : string
Generate a sha256 salted hash of a string.
generateToken()  : string
Generate a unique random token, based on a string.
verifPassword()  : bool
Verify the password matches the hash.

Properties

$cost

Iterations for hash.

private static int $cost = 12

Password hash cost.

Methods

generateHash()

Generate a sha256 salted hash of a string.

public static generateHash(string $string) : string
Parameters
$string : string

String to hash.

Return values
string

generateToken()

Generate a unique random token, based on a string.

public static generateToken(string $string) : string
Parameters
$string : string

String to create a token from.

Return values
string

verifPassword()

Verify the password matches the hash.

public static verifPassword(string $password, string $hash) : bool
Parameters
$password : string

Password.

$hash : string

Hash.

Return values
bool

Search results