48 return function_exists(
'md5');
59 public function generate_hash (
string $pwd,
bool $locked = FALSE): string
61 $salt0 = substr(pack(
'h*', md5(random_int(0, PHP_INT_MAX))), 0, 8);
62 $salt = substr(pack(
'H*', md5($salt0 . $pwd)), 0, 4);
63 return '{SMD5}'.($locked ?
'!' :
'').base64_encode(pack(
'H*', md5($pwd . $salt)) . $salt);
66 function checkPassword ($pwd, $hash):
bool 68 $hash = base64_decode(substr($hash, 6));
69 $salt = substr($hash, 16);
70 $hash = substr($hash, 0, 16);
71 $nhash = pack(
'H*', md5($pwd . $salt));
72 return ($nhash == $hash);
static get_hash_name()
Get the hash name.
generate_hash(string $pwd, bool $locked=FALSE)
Generate template hash.
is_available()
Is available.
__construct()
passwordMethodSmd5 Constructor
This class contains all the functions for sdm5 password method.
This class contains all the basic function for password methods.