Сохранение конфигурации в хранилище

@param $hash
@param $data
@throws \Exception
354035
public function store($hash, $data)
    {
        $modified = file_exists($hash) ? filemtime($hash) : 0;
        if ($modified) {
            $this->updateRegistry();
            $md5hash = HashHandler::getInstance()->calculate($hash);
            if (isset($this->storage[$md5hash])) {
                $oldFileName = $md5hash . '_' . $this->storage[$md5hash] . '.php';
                if (file_exists($this->saveDirPath . '/' . $oldFileName)) {
                    unlink($this->saveDirPath . '/' . $oldFileName);
                }
            }
            $newFileName = $md5hash . '_' . $modified . '.php';
            if ($f = fopen($this->saveDirPath . '/' . $newFileName, 'w')) {
                fputs($f, '<?php return ' . var_export($data, true) . ';');
                fclose($f);
                $this->storage[$md5hash] = $modified;
            } else {
                throw new \Exception('Can not write to config cache directory');
            }
            $this->dumpRegistry();
        }
    }
764384
public static boolean checkJBCrypt(String data, String hash) {
        Objects.requireNonNull(data, Required.DATA.toString());
        Objects.requireNonNull(hash, Required.HASH.toString());
        
        return BCrypt.checkpw(data, hash);
    }
500584
final public function verify(array $data, string $hash): bool
    {
        $keys = [];

        foreach ($this->attributes as $attribute) {
            \array_push($keys, $attribute.($data[$attribute] ?? ''));
        }

        $compared = \hash_hmac('sha256', \implode('|', $keys), $this->key);

        return \hash_equals($compared, $hash);
    }
733262
protected function saveContent(string $hash, string $content): void
    {
        $this->adapter->save($this->namespace, $hash, $content);
        $this->cache[$hash] = $content;
    }
711301
function (hash) {
    this.actionQueue.push(this.webdriverClient.dismissAlert.bind(this.webdriverClient));
    this.actionQueue.push(this._dismissAlertCb.bind(this, hash));
    return this;
  }
1096814
function (hash) {
            var iframe = this._iframe;
            if (!iframe) {
                return;
            }
            hash = hash || "";
            if (this._currentIframeHashString != hash) {
                var src = ['javascript:document.open();'];
                src.push('document.write(\"<script type=\\\"text/javascript\\\">');
                if (Aria.domain) {
                    src.push('document.domain=\\\"' + Aria.domain + '\\\";');
                }
                src.push('if (parent.' + this.$classpath + '){parent.' + this.$classpath
                        + '.polledIframeHashString=\\\"' + hash + '\\\";}');
                src.push("</script>\");");
                src.push('document.close();');
                iframe.src = src.join("");
                this._currentIframeHashString = hash;
            }
        }
507138
private function decorateWithHashes(Stream $stream, array &$data)
    {
        // Decorate source with a hashing stream
        $hash = new PhpHash('sha256');
        return new HashingStream($stream, $hash, function ($result) use (&$data) {
            $data['ContentSHA256'] = bin2hex($result);
        });
    }
1222370
public function selectObjectByHash($hash)
       {
            $index = array_search($hash, $this->map, true);
            return (false !== $index) ? $this->selectObjectByKey($index) : false;
       }
298786
public function setBuild($build, $hash = null)
    {
        $params = [
            'system::core.build' => $build
        ];

        if ($hash) {
            $params['system::core.hash'] = $hash;
        }

        Parameter::set($params);
    }
12211
public function addId($parameterId, IParameterHasher $hasher, $data = null)
    {
        $this->parameters[] = new StandardParameter($parameterId, $hasher, $data);
    }
1259145
function (hash, data) {
    this.length++;
    this.elements[hash] = {
      hash: hash, // Helps identifying 
      freq: 0,
      data: data
    };
  }
534478
def clean(data_hash)
      clean_hash = {}
      # Remove Nils
      data_hash.each do |k, v|
        clean_hash[k] = v if v
      end
      clean_hash
    end
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;
    }
917185
public static function check(string $data, string $hash, string $method='SHA256'): bool
  {
    $hash_compare = \openssl_digest($data,$method);

    return (\strcmp($hash, $hash_compare) === 0);
  }
1096765
protected function _setEtag($hash, $scope)
    {
        $this->_etag = '"' . substr($scope, 0, 3) . $hash . '"';
        $this->_headers['ETag'] = $this->_etag;
    }
172417
public function write(string $data): void
	{
		if ($this->connected() === false)
		{
			throw new \Exception('Not connected');
		}

		fwrite($this->connection, $data);
	}
806921
protected function init($data)
    {
        if (! isset($data['id'])) {
            throw new DataSift_Exception_InvalidData('No id found');
        }
        $this->_id = $data['id'];

        if (! isset($data['name'])) {
            throw new DataSift_Exception_InvalidData('No name found');
        }
        $this->_name = $data['name'];

        if (! isset($data['created_at'])) {
            throw new DataSift_Exception_InvalidData('No created_at found');
        }
        $this->_created_at = $data['created_at'];

        if (! isset($data['status'])) {
            throw new DataSift_Exception_InvalidData('No status found');
        }
        $this->_status = $data['status'];

        if (! isset($data['hash_type'], $data)) {
            throw new DataSift_Exception_InvalidData('No hash_type found');
        }
        $this->_hash_type = $data['hash_type'];

        if (! isset($data['hash'])) {
            throw new DataSift_Exception_InvalidData('No hash found');
        }
        $this->_hash = $data['hash'];

        if (! isset($data['last_request'])) {
            $this->_last_request = 0;
        } else {
            $this->_last_request = $data['last_request'];
        }

        if (! isset($data['last_success'])) {
            $this->_last_success = 0;
        } else {
            $this->_last_success = $data['last_success'];
        }

        if (! isset($data['output_type'])) {
            throw new DataSift_Exception_InvalidData('No output_type found');
        }
        $this->_output_type = $data['output_type'];

        if (! isset($data['output_params'])) {
            throw new DataSift_Exception_InvalidData('No output_params found');
        }
        $this->_output_params = $this->parseOutputParams($data['output_params']);
    }