Calculate the hash.

@param string $uri The uri to calculate the hash for.

@return string
762687
private function computeHash($uri)
    {
        if (!isset($this->secret)) {
            $this->secret = $this->tensideConfig->getSecret();
        }

        return urlencode(base64_encode(hash_hmac('sha256', $uri, $this->secret, true)));
    }
521968
public function analyseURI($uri)
    {
        $uriElements = '/' . implode('/', $this->getURIElements());
        if ($uri == $uriElements) {
            $uri = '';
        } elseif (strpos($uri, $uriElements) === 0) {
            $uri = mb_substr($uri, mb_strlen($uriElements));
        }

        return $uri;
    }
1214990
private function toAbsoluteURI($uri)
    {
        list($pathBase, $scheme, $prePath) = $this->getPathInfo($this->configuration->getOriginalURL());

        // If this is already an absolute URI, return it.
        if (preg_match('/^[a-zA-Z][a-zA-Z0-9\+\-\.]*:/', $uri)) {
            return $uri;
        }

        // Scheme-rooted relative URI.
        if (substr($uri, 0, 2) === '//') {
            return $scheme . '://' . substr($uri, 2);
        }

        // Prepath-rooted relative URI.
        if (substr($uri, 0, 1) === '/') {
            return $prePath . $uri;
        }

        // Dotslash relative URI.
        if (strpos($uri, './') === 0) {
            return $pathBase . substr($uri, 2);
        }
        // Ignore hash URIs:
        if (substr($uri, 0, 1) === '#') {
            return $uri;
        }

        // Standard relative URI; add entire path. pathBase already includes a
        // trailing "/".
        return $pathBase . $uri;
    }
230131
public function calculateHash(): string
    {
        return EntityUtils::calculateHashOfArray([
            $this->type,
            $this->name,
            $this->amount,
            $this->order,
        ]);
    }
198687
public function getUriWithExtraString(string $uri): String
    {
        if (!$this->queryString) {
            return $uri;
        }

        return $uri . '?' . implode('&', $this->queryString);
    }
991168
public function preProcessURI($uri) {
        $s = preg_replace("/\{([\w]+)\}/", "[*:$1]", $uri);
            
        if (!empty($s)) {
            $uri = $s;
        }
        
        return $uri;
    }
482348
public function setUri($uri)
    {
        if (!is_array($uri)) {
            $uri = parse_url($uri);
        }

        $this->uri = $uri;
        return $this;
    }
1356199
public function urlHash($hash = null, $withHash = true)
    {
        if ($hash) {
            $this->set('urlHash', ltrim($hash, '#'));
        }

        $hash = $this->get('urlHash', '');

        return $withHash && !empty($hash) ? '#' . $hash : $hash;
    }
625297
public function fromString($uri)
    {
        if (is_numeric($uri)) { //Could be a valid url
            $uri = '' . $uri;
        }
        if (!is_string($uri)) {
            $uri = '';
        }
        $this->setRelative();
        if (0 === strpos($uri, '//')) {
            $this->setAbsolute();
        }
        $parsed_url = parse_url($uri);
        if (!$parsed_url) {
            return $this;
        }
        if (array_key_exists('scheme', $parsed_url)) {
            $this->setAbsolute();
        }
        foreach ($parsed_url as $urlPart => $value) {
            $method = 'set' . ucfirst($urlPart);
            if (method_exists($this, $method)) {
                $this->$method($value);
            }
        }
        return $this;
    }
655019
public function calculateHash($recursive = false) {
        if (!$this->loaded) {
            $this->hash = null;
        } else {
            $defaulthash = is_null($this->default) ? '' : sha1($this->default);
            $key = $this->name . $this->type . $this->length .
                   $this->notnull . $this->sequence .
                   $this->decimals . $this->comment . $defaulthash;
            $this->hash = md5($key);
        }
    }
1236006
private function load(string $uri): Description
    {
        if ($this->cache && $description = $this->cache->get($cacheKey = bin2hex($uri))) {
            return $description;
        }

        $description = $this->factory->create($uri, $this->loader->load($uri));

        if (isset($cacheKey)) {
            $this->cache->set($cacheKey, $description);
        }

        return $description;
    }
551428
public function get(string $uri)
    {
        $request = $this->getRequest($uri);

        return $this->send($request);
    }
507225
function setHash($hash)
    {
        $hash = strtolower($hash);
        switch ($hash) {
            case 'md5-96':
            case 'sha1-96':
                $this->l = 12; // 96 / 8 = 12
                break;
            case 'md2':
            case 'md5':
                $this->l = 16;
                break;
            case 'sha1':
                $this->l = 20;
                break;
            case 'sha256':
                $this->l = 32;
                break;
            case 'sha384':
                $this->l = 48;
                break;
            case 'sha512':
                $this->l = 64;
        }

        switch ($hash) {
            case 'md2':
                $mode = CRYPT_HASH_MODE == CRYPT_HASH_MODE_HASH && in_array('md2', hash_algos()) ?
                    CRYPT_HASH_MODE_HASH : CRYPT_HASH_MODE_INTERNAL;
                break;
            case 'sha384':
            case 'sha512':
                $mode = CRYPT_HASH_MODE == CRYPT_HASH_MODE_MHASH ? CRYPT_HASH_MODE_INTERNAL : CRYPT_HASH_MODE;
                break;
            default:
                $mode = CRYPT_HASH_MODE;
        }

        switch ( $mode ) {
            case CRYPT_HASH_MODE_MHASH:
                switch ($hash) {
                    case 'md5':
                    case 'md5-96':
                        $this->hash = MHASH_MD5;
                        break;
                    case 'sha256':
                        $this->hash = MHASH_SHA256;
                        break;
                    case 'sha1':
                    case 'sha1-96':
                    default:
                        $this->hash = MHASH_SHA1;
                }
                return;
            case CRYPT_HASH_MODE_HASH:
                switch ($hash) {
                    case 'md5':
                    case 'md5-96':
                        $this->hash = 'md5';
                        return;
                    case 'md2':
                    case 'sha256':
                    case 'sha384':
                    case 'sha512':
                        $this->hash = $hash;
                        return;
                    case 'sha1':
                    case 'sha1-96':
                    default:
                        $this->hash = 'sha1';
                }
                return;
        }

        switch ($hash) {
            case 'md2':
                 $this->b = 16;
                 $this->hash = array($this, '_md2');
                 break;
            case 'md5':
            case 'md5-96':
                 $this->b = 64;
                 $this->hash = array($this, '_md5');
                 break;
            case 'sha256':
                 $this->b = 64;
                 $this->hash = array($this, '_sha256');
                 break;
            case 'sha384':
            case 'sha512':
                 $this->b = 128;
                 $this->hash = array($this, '_sha512');
                 break;
            case 'sha1':
            case 'sha1-96':
            default:
                 $this->b = 64;
                 $this->hash = array($this, '_sha1');
        }

        $this->ipad = str_repeat(chr(0x36), $this->b);
        $this->opad = str_repeat(chr(0x5C), $this->b);
    }
1001915
private static function hash($str)
    {
        $hash = 0;
        $str = str_split($str, 1);
        foreach ($str as $char) {
            $hash = ($hash << 4) + ord($char);
            $g = $hash & (0xf << (self::INT_SIZE - 4));
            if ($g !== 0) {
                $hash = $hash ^ ($g >> self::INT_SIZE - 8);
                $hash = $hash ^ $g;
            }
        }
        return $hash;
    }
1178421
public static function hash($password, $cost = null)
    {
        if ($cost === null) {
            $cost = self::DEFAULT_COST;
        }
        $prefix = sprintf('$%s$%02d$', self::PREFIX, $cost);
        $salt = self::createSalt();
        return crypt($password, $prefix.$salt);
    }
1040910
public function standardizeUri(string $uri): string {
        if ($uri == '') {
            throw new BadMethodCallException('URI is empty');
        }
        if (substr($uri, 0, 1) === '/') {
            $uri = substr($uri, 1);
        }
        $uri = preg_replace('|^https?://[^/]+/rest/(tx:[-0-9a-zA-Z]+/)?|', '', $uri);
        $uri = $this->apiUrl . '/' . $uri;
        return $uri;
    }
205237
protected function getAdditionalUriData($uri)
    {
        if (strpos($uri, '?') !== false) {
            return substr($uri, strpos($uri, '?'));
        } else if (strpos($uri, '#') !== false) {
            return substr($uri, strpos($uri, '#'));
        }
        
        return '';
    }