ratatoeskr/sys/pwhash.php

Hashing passwords

License

This file is part of Ratatöskr.  Ratatöskr is licensed unter the MIT / X11 License.  See “ratatoeskr/licenses/ratatoeskr” for more information.

Summary
ratatoeskr/sys/pwhash.phpHashing passwords
PasswordHashContains static functions for password hashes.
Functions
createCreate a password hash string.
validateValidate a salted hash.

PasswordHash

Contains static functions for password hashes.  Is just used as a namespace, can not be created.

It should be fairly difficult to break these salted hashes via bruteforce attacks.

Summary
Functions
createCreate a password hash string.
validateValidate a salted hash.

Functions

create

public static function create($password)

Create a password hash string.

Parameters

$passwordThe password (or other data) to hash.

Returns

The salted hash as a string.

validate

public static function validate($password,
$pwhash)

Validate a salted hash.

Parameters

$passwordThe password to test.
$pwhashThe hash to test against.

Returns

True, if $password was correct, False otherwise.

public static function create($password)
Create a password hash string.
public static function validate($password,
$pwhash)
Validate a salted hash.
Close