48 return function_exists(
'hash');
59 public function generate_hash (
string $pwd,
bool $locked = FALSE): string
61 if (function_exists(
'hash')) {
62 $salt = substr(pack(
'h*', md5(
"".random_int(0, PHP_INT_MAX))), 0, 8);
63 $salt = substr(pack(
'H*', sha1($salt.$pwd)), 0, 4);
64 $pwd =
'{SSHA512}'.($locked ?
'!' :
'').base64_encode(hash(
'sha512', $pwd.$salt, TRUE).$salt);
71 function checkPassword ($pwd, $hash):
bool 73 $hash = base64_decode(substr($hash, 9));
74 $salt = substr($hash, 64);
75 $hash = substr($hash, 0, 64);
76 if (function_exists(
'hash')) {
77 $nhash = hash(
'sha512', $pwd.$salt, TRUE);
83 return ($nhash == $hash);
__construct()
passwordMethodSsha512 Constructor
This class contains all the functions for ssha password method.
is_available()
Is available.
Parent class for all exceptions thrown in FusionDirectory.
static missingext($name)
Display about missing PHP extension.
generate_hash(string $pwd, bool $locked=FALSE)
Generate template hash.
This class contains all the basic function for password methods.
Parent class for all errors in FusionDirectory.
static get_hash_name()
Get the hash name.