An alias for {@see cspHash} with [isFile](cspHash#isFile) set to `true`.

@api

@param string $friendlyDirective
@param string $string
@param ?string $algo = 'sha256'
@param mixed $reportOnly

@return string
184957
public function cspHashFile(
        $friendlyDirective,
        $string,
        $algo = null,
        $reportOnly = null
    ) {
        Types::assert(
            ['string' => [$friendlyDirective, $string], '?string' => [$algo]]
        );

        return $this->cspHash(
            $friendlyDirective,
            $string,
            $algo,
            true,
            $reportOnly
        );
    }
653673
public function hash($algo = 'md5', $format = null, $raw_output = false)
	{
		return hash($algo, parent::format($format === null ? static::$format : $format), $raw_output);
	}
695050
protected function _releaseFile($sIdent, $iLockMode = LOCK_EX)
    {
        $blSuccess = true;
        if (isset($this->_aLockedFileHandles[$iLockMode][$sIdent]) &&
            $this->_aLockedFileHandles[$iLockMode][$sIdent] !== false
        ) {
            // release the lock and close file
            $blSuccess = flock($this->_aLockedFileHandles[$iLockMode][$sIdent], LOCK_UN) &&
                         fclose($this->_aLockedFileHandles[$iLockMode][$sIdent]);
            unset($this->_aLockedFileHandles[$iLockMode][$sIdent]);
        }

        return $blSuccess;
    }
908063
public function csproHash(
        $friendlyDirective,
        $string,
        $algo = null,
        $isFile = null
    ) {
        Types::assert(
            ['string' => [$friendlyDirective, $string], '?string' => [$algo]]
        );

        return $this->cspHash(
            $friendlyDirective,
            $string,
            $algo,
            $isFile,
            true
        );
    }
675707
protected function writeCompiledEnvoyFile($compiler, $path, $serversOnly)
    {
        file_put_contents(
            $envoyPath = getcwd().'/Envoy'.md5_file($path).'.php',
            $compiler->compile(file_get_contents($path), $serversOnly)
        );

        return $envoyPath;
    }
1050094
public static function addFormatterTo(Writer $csv, string $whitespace_replace): Writer
    {
        if ('' == $whitespace_replace || strlen($whitespace_replace) != strcspn($whitespace_replace, self::$force_enclosure)) {
            throw new InvalidArgumentException('The sequence contains a character that enforces enclosure or is a CSV control character or is the empty string.');
        }

        $mapper = static function ($value) use ($whitespace_replace) {
            if (is_string($value)) {
                return str_replace(' ', $whitespace_replace, $value);
            }

            return $value;
        };

        $formatter = static function (array $record) use ($mapper): array {
            return array_map($mapper, $record);
        };

        return $csv->addFormatter($formatter);
    }
136083
public function scanOnly($c = true, &$list = array(), $exclude_extension = array(), $exclude_file = array(), $exclude_dir = array(), $dir = "")
    {
        $aFiles = $this->scan($c, $list, $exclude_extension, $exclude_file, $exclude_dir, $dir);

        $list = array();

        foreach ($aFiles as $key => $v) {

            if (isset($c['extension']) && preg_match('/' . $c['extension'] . '/i', $v['extension'])) {
                $list[$key] = $v;
            }

            if (isset($c['type']) && preg_match('/' . $c['type'] . '/i', $v['type'])) {
                $list[$key] = $v;
            }

        }

        return $list;

    }
1357972
public static function hash($object, $algoOrCtx = 'md5', $raw = FALSE)
	{
		if (is_string($algoOrCtx)) {
			$ctx = hash_init($algoOrCtx);
		} else {
			$ctx = $algoOrCtx;
		}

		if (isset($object->name)) {
			hash_update($ctx, 'name');
			hash_update($ctx, (string)$object->name);
		}

		if (isset($object->field)) {
			hash_update($ctx, 'field');
			foreach ($object->field instanceof \Traversable ? $object->field : (array)$object->field as $v0) {
				FieldDescriptorProtoMeta::hash($v0, $ctx);
			}
		}

		if (isset($object->extension)) {
			hash_update($ctx, 'extension');
			foreach ($object->extension instanceof \Traversable ? $object->extension : (array)$object->extension as $v0) {
				FieldDescriptorProtoMeta::hash($v0, $ctx);
			}
		}

		if (isset($object->nestedType)) {
			hash_update($ctx, 'nestedType');
			foreach ($object->nestedType instanceof \Traversable ? $object->nestedType : (array)$object->nestedType as $v0) {
				DescriptorProtoMeta::hash($v0, $ctx);
			}
		}

		if (isset($object->enumType)) {
			hash_update($ctx, 'enumType');
			foreach ($object->enumType instanceof \Traversable ? $object->enumType : (array)$object->enumType as $v0) {
				EnumDescriptorProtoMeta::hash($v0, $ctx);
			}
		}

		if (isset($object->extensionRange)) {
			hash_update($ctx, 'extensionRange');
			foreach ($object->extensionRange instanceof \Traversable ? $object->extensionRange : (array)$object->extensionRange as $v0) {
				ExtensionRangeMeta::hash($v0, $ctx);
			}
		}

		if (isset($object->oneofDecl)) {
			hash_update($ctx, 'oneofDecl');
			foreach ($object->oneofDecl instanceof \Traversable ? $object->oneofDecl : (array)$object->oneofDecl as $v0) {
				OneofDescriptorProtoMeta::hash($v0, $ctx);
			}
		}

		if (isset($object->options)) {
			hash_update($ctx, 'options');
			MessageOptionsMeta::hash($object->options, $ctx);
		}

		if (isset($object->reservedRange)) {
			hash_update($ctx, 'reservedRange');
			foreach ($object->reservedRange instanceof \Traversable ? $object->reservedRange : (array)$object->reservedRange as $v0) {
				ReservedRangeMeta::hash($v0, $ctx);
			}
		}

		if (isset($object->reservedName)) {
			hash_update($ctx, 'reservedName');
			foreach ($object->reservedName instanceof \Traversable ? $object->reservedName : (array)$object->reservedName as $v0) {
				hash_update($ctx, (string)$v0);
			}
		}

		if (is_string($algoOrCtx)) {
			return hash_final($ctx, $raw);
		} else {
			return null;
		}
	}
1220735
public function all($fields = [], $sorted = true, $sortBy = 'cn', $sortByDirection = 'asc')
    {
        $namingContext = $this->getConfigurationNamingContext();

        if ($namingContext) {
            $search = $this->adldap->search()
                ->setDn($namingContext)
                ->select($fields)
                ->where('objectCategory', '=', $this->serverObjectCategory);

            if ($sorted) {
                $search->sortBy($sortBy, $sortByDirection);
            }

            return $search->get();
        }

        return false;
    }
993025
public static function hash($object, $algoOrCtx = 'md5', $raw = FALSE)
	{
		if (is_string($algoOrCtx)) {
			$ctx = hash_init($algoOrCtx);
		} else {
			$ctx = $algoOrCtx;
		}

		if (isset($object->x)) {
			hash_update($ctx, 'x');
			EmbeddedMeta::hash($object->x, $ctx);
		}

		if (is_string($algoOrCtx)) {
			return hash_final($ctx, $raw);
		} else {
			return null;
		}
	}
1220891
public static function hash( string $algo = 'sha1', string $data = NULL )
    {
        if (!$data){
            $data = microtime().uniqid(mt_rand(),1);
        }
        return hash( $algo, $data );
    }
1014458
protected function _algoToCipher(CipherAlgorithmIdentifier $algo): string
    {
        $oid = $algo->oid();
        if (array_key_exists($oid, self::MAP_CIPHER_OID_TO_NAME)) {
            return self::MAP_CIPHER_OID_TO_NAME[$oid];
        }
        if (AlgorithmIdentifier::OID_RC2_CBC == $oid) {
            if (!$algo instanceof RC2CBCAlgorithmIdentifier) {
                throw new \UnexpectedValueException('Not an RC2-CBC algorithm.');
            }
            return $this->_rc2AlgoToCipher($algo);
        }
        throw new \UnexpectedValueException(
            sprintf('Cipher method %s not supported.', $algo->name()));
    }
995411
private function longDirective($friendlyDirective)
    {
        Types::assert(['string' => [$friendlyDirective]]);

        $friendlyDirective = strtolower($friendlyDirective);

        if (isset($this->cspDirectiveShortcuts[$friendlyDirective]))
        {
            $directive = $this->cspDirectiveShortcuts[$friendlyDirective];
        }
        else
        {
            $directive = $friendlyDirective;
        }

        return $directive;
    }
1108427
public function report($reportName, $dom, $path)
    {
        switch ($reportName) {
            case '{'.self::NS_CARDDAV.'}addressbook-multiget':
                $this->server->transactionType = 'report-addressbook-multiget';
                $this->addressbookMultiGetReport($dom);

                return false;
            case '{'.self::NS_CARDDAV.'}addressbook-query':
                $this->server->transactionType = 'report-addressbook-query';
                $this->addressBookQueryReport($dom);

                return false;
            default:
                return;
        }
    }
1025168
private static function _oidForEC(HashAlgorithmIdentifier $hash_algo): string
    {
        if (!array_key_exists($hash_algo->oid(), self::MAP_EC_OID)) {
            throw new \UnexpectedValueException(
                sprintf("No EC signature algorithm for %s.", $hash_algo->name()));
        }
        return self::MAP_EC_OID[$hash_algo->oid()];
    }
697723
public static function opensslVerify(
        $str,
        $sinature,
        $publicKeyPath,
        $algo = OPENSSL_ALGO_SHA1,
        $format = self::FORMAT_HEX
    )
    {
        $publicKey = openssl_pkey_get_public(file_get_contents($publicKeyPath));

        $sinature = trim($sinature);

        switch ($format) {
            case self::FORMAT_HEX:
                $sinature = hex2bin($sinature);
                break;
            case self::FORMAT_BASE64:
                $sinature = EncodeHelper::base64Decode($sinature);
                break;
            default:
                $sinature = hex2bin($sinature);
        }

        $res = openssl_verify(trim($str), $sinature, $publicKey, $algo);

        openssl_free_key($publicKey);

        if ($res == 1) {
            return true;
        }

        return false;
    }
918573
private function &getCSPObject($reportOnly)
    {
        if ( ! isset($reportOnly) or ! $reportOnly)
        {
            $csp = &$this->csp;
        }
        else
        {
            $csp = &$this->cspro;
        }

        return $csp;
    }