@param string $host
@param string $uri
@param string $key
@param string $secret

@return string
976406
public static function generateImageSecretSignature($host, $uri, $key, $secret)
    {
        $host = strtolower($host);
        $key = (string) $key;

        $base = [];

        $magicsLength = sizeof(self::$imageUrlSecretMagics);
        $additional = [$host, $uri, $secret, $key];
        $offset = 0;
        foreach (str_split($key) as $number) {
            $offset += $number;
            $magic = self::$imageUrlSecretMagics[$offset % $magicsLength];
            $base[] = $magic;
            $base[] = array_pop($additional);
            $offset += ord($magic[0]);
            $base[] = sha1($offset, true);
            if (!$additional) {
                break;
            }
        }
        $base = join(chr($offset & 0xff), $base);
        $sha1 = str_split(sha1($base, true));
        $base = [];
        for ($i = 0; $i < 24; $i++) {
            $base[] = $sha1[($i + $offset)%sizeof($sha1)];
        }
        $base = join('', $base);
        
        return str_replace(['+', '/', '='], ['-', '_', ''], base64_encode($base))
                . substr($key, -2);
    }
800081
public function setHost($host)
    {
        if (substr($host, -1) === '/') {
            $host = substr($host, 0, -1);
        }

        $headers = $this->getConfig('headers');
        $headers['Host'] = $host;
        $this->setConfigOption('headers', $headers);

        if (strpos('/', $host) === false) {
            $host = 'https://' . $host;
        }
        $this->setConfigOption('base_uri', $host);

        return $this;
    }
301139
public static function createFromString (string $uri)
    {
        $parts = parse_url($uri);
        $scheme = isset($parts['scheme']) ? $parts['scheme'] : '';
        $user = isset($parts['user']) ? $parts['user'] : '';
        $pass = isset($parts['pass']) ? $parts['pass'] : '';
        $host = isset($parts['host']) ? $parts['host'] : '';
        $port = isset($parts['port']) ? $parts['port'] : null;
        $path = isset($parts['path']) ? $parts['path'] : '';
        $query = isset($parts['query']) ? $parts['query'] : '';
        $fragment = isset($parts['fragment']) ? $parts['fragment'] : '';

        return new \Resilient\Http\Uri($scheme, $host, $port, $path, $query, $fragment, $user, $pass);
    }
318751
public final function withHost($host): UriInterface
   {
       if (!is_string($host) || !($parsedHost = $this->parseHost($host))) {
           throw new InvalidArgumentException(
               "Can't get with host: invalid host name");
       }
       return $this->with("host", $parsedHost);
   }
1267551
protected function setHost($host)
    {
        $this->uriString = null;

        $this->host = (string) $host;

        return $this;
    }
254322
public static function getHeader(string $token, string $secret): array
    {
        $parser = self::parser($token, $secret);

        return $parser->validate()->parse()->getHeader();
    }
129927
public function show(string $host, array $params = [])
    {
        $path = $this->buildKnownHostsPath($host);

        return $this->get($path, $params);
    }
1337125
public static function sslConnect($host, $user, $password, $name, $key, $cert, $ca)
    {
        if ($key == "" || $cert == "" || $ca == "") {
            throw new MysqlUtilsException("SSL parameters error");
        }

        $mysqliRef = mysqli_init();
        $mysqliRef->ssl_set($key, $cert, $ca, null, null);

        $connected = @$mysqliRef->real_connect($host,
            $user,
            $password,
            $name,
            3306,
            null,
            MYSQLI_CLIENT_SSL);

        if (!$connected || $mysqliRef->connect_error) {
            throw new MysqlUtilsException('Database connection error ('.$mysqliRef->connect_errno.') '.$mysqliRef->connect_error);
        }

        return $mysqliRef;
    }
77166
public function getQRCodeInline($company, $holder, $secret, $size = 200, $encoding = 'utf-8')
    {
        return $this->getBaconQRCodeVersion() === 1
            ? $this->getQRCodeInlineV1($company, $holder, $secret, $size, $encoding)
            : $this->getQRCodeInlineV2($company, $holder, $secret, $size, $encoding);
    }
393031
public static function factory($key, $secret, $from)
    {
        $sms = new Sms(new GuzzleHttp\Client());
        $sms->setKey($key)
            ->setSecret($secret)
            ->setFrom($from);
        
        return $sms;
    }
351076
public function buildCacheKey(string $uri, string $query = ''): string
    {

        if ($query != '')
            $query = $this->hashString($query);

        return $this->prefix . $this->hashString($uri . $query);
    }
1026354
public function consumer($url, $key, $secret)
    {
        Argument::i()
            //argument 1 must be a string
            ->test(1, 'string')
            //argument 2 must be a string
            ->test(2, 'string')
            //argument 3 must be a string
            ->test(3, 'string');
            
        return Consumer::i($url, $key, $secret);
    }
1094904
private function toSha256($fields, $secret)
    {
        $hasData = '';

        foreach ($this->getHashKeys() as $key) {
            if (isset($fields[$key])) {
                $hasData .= $fields[$key];
            }
        }
        $hasData .= $secret;
        return hash('sha256', trim($hasData));
    }
534053
public function setHost($host = null)
    {
        if ($host === null) {
            $host = '127.0.0.1';
        }

        if (substr($host, 0, 6) == 'ssl://') {
            $this->_protocol = 'ssl';
            $this->_secure = 'ssl';
            $host = substr($host, 6);
        }
        $this->_host = $host;
    }
1185727
static function secret($page_name = '', $length = 32, $return = false)
    {
        $secret = uniqid(RandomKey::string($length));
        if ($return)
        {
            return $secret;
        }
        else
        {
            $k = 'form_' . $page_name;
            setcookie($k, $secret, 0, '/');
            if (!isset($_SESSION))
            {
                session();
            }
            $_SESSION[$k] = $secret;
        }
    }
634644
public function verifySignature($uri, $secret, $paramName)
    {
        $getParams = array();
        parse_str(parse_url($uri, PHP_URL_QUERY), $getParams);

        if (!isset($getParams[$paramName])) {
            return false;
        }

        // Explode hash and data from eachother
        $parts = explode('.', $getParams[$paramName]);

        $data = array_pop($parts);

        // Decode the data
        $data = json_decode($this->base64UriDecode($data));

        // Create a new signature based on the secret and data and compare it to the data
        // we're verifying, if it is correct, return the signed data.
        if ($this->createSignature($secret, $data) === $getParams[$paramName]) {
            return $data;
        }

        return false;
    }
1064704
public function withHost($host)
        {
            if(!is_string($host)){
                throw new InvalidArgumentException('Uri host must be a string');
            }

            $clone = clone $this;
            $clone->host = $this->removePortFromHost($host);
            return $clone;
        }