Compares a password and its hashed value using PHP's `crypt()`. Rather than a simple string
comparison, this method uses a constant-time algorithm to defend against timing attacks.
Parameters
- string $password The password to check.
- string $hash The hashed password to compare it to.
Returns
boolean Returns a boolean indicating whether the password is correct.Source
public static function check($password, $hash) {
return String::compare(crypt($password, $hash), $hash);
}