public static function verify($string, $hash)
    {
        $pattern = '~^'.preg_quote(self::PREFIX).'(?<salt>[A-Za-z0-9\./]{8})\$(?<sub>[A-Za-z0-9\./]+)$~is';
        if (!preg_match($pattern, $hash, $matches)) {
            return false;
        }
        return ($matches['sub'] === self::createSubHash($string, $matches['salt']));
    }