date.chapril.org-framadate/app/classes/Framadate/Security/PasswordHasher.php
Thomas Citharel 3157d6a590 Run php-cs-fixer with a custom config. This may break a lot of things
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
2018-02-19 19:43:30 +01:00

34 lines
817 B
PHP

<?php
namespace Framadate\Security;
/**
* Class PasswordHasher
*
* Used to abstract the password hash logic
*
* @package Framadate\Security
*/
class PasswordHasher {
/**
* Hash a password
*
* @param string $password the password to hash.
* @return false|string the hashed password, or false on failure. The used algorithm, cost and salt are returned as part of the hash.
*/
public static function hash($password) {
return password_hash($password, PASSWORD_DEFAULT);
}
/**
* Verify a password with a hash
*
* @param string $password the password to verify
* @param string $hash the hash to compare.
* @return bool
*/
public static function verify($password, $hash) {
return password_verify($password, $hash);
}
}