Sets a binary string containing the hash that is used as base for this
icon. The string should contain at least 6 bytes.

@param string $hash Binary string containing the hash.
763876
public function setHash($hash)
    {
        if (!is_string($hash)) {
            throw new \InvalidArgumentException(
                'An invalid $hash was passed to Identicon. ' .
                'A binary string was expected.');
        }
        if (strlen($hash) < 6) {
            throw new \InvalidArgumentException(
                'An invalid $hash was passed to Identicon. ' . 
                'The hash was expected to contain at least 6 bytes.');
        }
        
        $this->hash = $hash;
        $this->value = null;
        $this->valueSet = false;
        return $this;
    }
24621
public function setGeohash(string $geohash): self
    {
        $this->_geohash = $geohash;
        $this->_locationType = self::LOCATION_TYPE_GEOHASH;

        return $this;
    }
105230
protected function updateHash()
    {
        $hash = $this->getClassName() . '_' . $this->getObjectId();
        $base64Hash = base64_encode($hash);

        $this->hash = $base64Hash;
    }
9621
def binary_encode_any_high_ascii_in_hash(hash)
      Hash[hash.map { |key, value| [key, binary_encode_any_high_ascii(value)] }]
    end
1177982
public function fromHash( $hash )
    {
        if ( !is_array( $hash ) )
        {
            return new Value( [] );
        }
        $metas = [];
        foreach ( $hash as $hashItem )
        {
            if ( !is_array( $hashItem ) )
            {
                continue;
            }
            $meta = new Meta();
            $meta->setName( $hashItem["meta_name"] );
            $meta->setContent( $hashItem["meta_content"] );
            $metas[] = $meta;
        }

        return new Value( $metas );
    }
1052262
public function forceExpiry($hash)
    {
        if (Symphony::Log()) {
            Symphony::Log()->pushDeprecateWarningToLog('Cacheable::forceExpiry()', 'Cacheable::delete()');
        }
        return $this->delete($hash);
    }
1030155
public function setKey($key)
    {
        $this->hash = null;

        if (empty($key)) {
            $this->key = null;
            return;
        }

        $this->key = (string) $key;
        $this->hash = $this->makeHash($key);
    }
687179
public function removeQueryHash($hash)
    {
        $queryHashes =& Archive::getByRef($this, 'query_hashes', array());
        unset($queryHashes[array_search($hash, $queryHashes)]);
        $queryHashes = array_values($queryHashes);
    }
809945
public function isStored($hash)
    {
        $modified = file_exists($hash) ? filemtime($hash) : 0;
        if ($modified) {
            $this->updateRegistry();
            $md5hash = HashHandler::getInstance()->calculate($hash);
            if (isset($this->storage[$md5hash])) {
                if (0 === $modified) return false;
                if ($this->storage[$md5hash] >= $modified) {
                    return true;
                }
            }
        }
        return false;
    }
404038
private function buildKeysCachingPath($hash)
    {
        $chunks = self::chunkSplitArr($hash, 2, '0');
        $chunksCount = count($chunks);
        if ($this->levels > $chunksCount) {
            $diff = $this->levels - $chunksCount;
            $tempArray = array_fill(0, $diff, '00');
            $chunks = array_merge($chunks, $tempArray);
        }

        return vsprintf($this->levelsString, $chunks);
    }
1284864
public function hash(string $string): Hash {
        $hash = new Hash();
        $hash->setAlgorithm($this->getAlgorithm());
        $value = hash($this->getAlgorithm(), $string, true);
        $hash->setValue($value);
        return $hash;
    }
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;
    }
797956
public function fromHash($hash)
    {
        if (!is_array($hash)) {
            return new Value();
        }

        $tags = [];
        $tagIds = [];
        foreach ($hash as $hashItem) {
            if (isset($hashItem['id'])) {
                $tagIds[] = $hashItem['id'];
            }
        }

        if (!empty($tagIds)) {
            $loadedTags = $this->tagsService->loadTagList($tagIds);
        } else {
            $loadedTags = [];
        }

        foreach ($hash as $hashItem) {
            if (!is_array($hashItem)) {
                continue;
            }

            if (!isset($hashItem['id'])) {
                $tags[] = new Tag(
                    [
                        'parentTagId' => $hashItem['parent_id'],
                        'keywords' => $hashItem['keywords'],
                        'mainLanguageCode' => $hashItem['main_language_code'],
                        'remoteId' => isset($hashItem['remote_id']) ?
                            $hashItem['remote_id'] :
                            null,
                        'alwaysAvailable' => isset($hashItem['always_available']) ?
                            $hashItem['always_available'] :
                            true,
                    ]
                );
            } elseif (isset($loadedTags[$hashItem['id']])) {
                $tags[] = $loadedTags[$hashItem['id']];
            }
            // We ignore tags which do not exist (missing in $loadedTags)
        }

        return new Value($tags);
    }
670752
public function getKeyStr($hash = true)
    {
        $key =  $this->key . self::$INDEX_SEPERATOR . $this->groupId . self::$TAG_SEPERATOR . implode(self::$TAG_SEPERATOR, $this->gatherTags());
        if($hash) {
             $key = md5($key);
        }
        return $key;
    }
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);
    }
543546
protected function convertBlockFromHash($hash)
    {
        if (isset($hash['items'])) {
            $items = array();

            foreach ($hash['items'] as $item) {
                $items[] = $this->convertItemFromHash($item);
            }

            $hash['items'] = $items;
        }

        return new Block($hash);
    }
996324
public static function verify_hash( $string, $hash ) 
	{
		if (is_numeric( $algo = ClanCats::$config->get( 'security.hash', 'md5') ))
		{
			return password_verify( $string, $hash );
		}
		return ($hash === call_user_func( $algo, $string ));
	}