@param $content

@return string
@throws VirgilCryptoException
19112
protected function calculateFingerprint($content)
    {
        try {
            if ($this->userSHA256Fingerprints) {
                $hash = $this->cryptoService->computeHash($content, HashAlgorithms::SHA256);
            } else {
                $hash = $this->cryptoService->computeHash($content, HashAlgorithms::SHA512);
                $hash = substr($hash, 0, 8);
            }

            return $hash;
        } catch (Exception $exception) {
            throw new VirgilCryptoException($exception->getMessage());
        }
    }
373913
public function sign($content) {
        if (is_array($content)) {
            $content = $this->getSignContent($content);
        }
        if ($this->getSignType() == self::MD5) {
            return md5($content.$this->public_key);
        }
        $priKey = $this->private_key;
        $res = "-----BEGIN RSA PRIVATE KEY-----\n" .
            wordwrap($priKey, 64, "\n", true) .
            "\n-----END RSA PRIVATE KEY-----";
        if (self::RSA2 == $this->getSignType()) {
            openssl_sign($content, $sign, $res, OPENSSL_ALGO_SHA256);
        } else {
            openssl_sign($content, $sign, $res);
        }
        if (is_resource($res)) {
            openssl_free_key($res);
        }
        return base64_encode($sign);
    }
665178
public function generateHash($content, $algorithm)
    {
        try {
            return $this->cryptoService->computeHash($content, $algorithm);

        } catch (Exception $exception) {
            throw new VirgilCryptoException($exception->getMessage());
        }
    }
903744
public function findPagesByContent($content)
    {
        $contentUids = array_merge($this->getContentsParentUids($content->getUid()), [$content->getUid()]);
        $contentUids = implode(', ', array_unique(array_map(function ($uid) {
            return '"'.$uid.'"';
        }, $contentUids)));

        $pageUids = $this->_em->getConnection()->executeQuery(
            sprintf('SELECT uid FROM page WHERE contentset IN (%s)', $contentUids)
        )->fetchAll(\PDO::FETCH_COLUMN);

        return $this->_em->createQueryBuilder('p')
            ->select('p')
            ->from('BackBee\NestedNode\Page', 'p')
            ->where('p._uid IN (:uids)')
            ->setParameter('uids', $pageUids)
            ->getQuery()
            ->getResult()
        ;
    }
673252
public function write($content)
    {
        $this->openForWrite();
        $writtenBytes = $this->file->fwrite($content);

        return $writtenBytes;
    }
749844
public static function getIndent($content)
    {
        $indent = self::DEFAULT_INDENT;
        preg_match(self::INDENT_REGEX, trim($content), $matches);

        if (!empty($matches)) {
            $indent = \strlen($matches[1]);
        }

        return $indent;
    }
619785
private function getTokenisedContent(string $content)
    {

        $tokens = token_get_all($content);


        $tokenised_content = array();
        $tokenised_content = $this->addToken($tokenised_content, $tokens, $content);

        return $tokenised_content;

    }
720332
protected function getEOL($content)
    {
        static $eols = [
            "\r\n",
            "\n",
            "\r",
        ];
        foreach($eols as $eol)
        {
            if(strpos($content, $eol))
            {
                return $eol;
            }
        }
        return PHP_EOL;
    }
715568
public static function shortcodeToEntities($content) {
        $replacements = self::getShortcodeEntities();
        return str_replace(array_keys($replacements), $replacements, $content);
    }
626193
public function prepareContent($content)
    {
        if (is_array($content)) {
            $ctt = '';
            foreach ($content as $key=>$ctt) {
                $content .= $ctt;
            }
            $content = $ctt;
        }
        $_escaped_output = strip_tags((string) $content);
        if ($_escaped_output != (string) $content) {
            if (preg_match('/(.*)<body(.*)</body>/i', (string) $content, $matches)) {
                $_output = $matches[0];
            } else {
                $_output = (string) $content;
            }
            $content = Html2Text::convert($_output);
        }
        return (string) $content;
    }
1041699
public function generate(string $content = null): string
    {
        if (empty($content)) {
            $guid = Uuid::uuid4();
        } else {
            $guid = Uuid::uuid5(Uuid::NAMESPACE_DNS, $content);
        }

        return $guid->toString();
    }
1084948
public function generateSearchText($content)
    {
        $userAliases = $content ? User::userAliases() : [];
        $userName = (is_numeric($content) && !empty($userAliases[$content])) ? $userAliases[$content] : $content;
        return parent::generateSearchText($userName);
    }
129588
public static function loadFromString(string $content, string $password = NULL): Pkcs12 {
        if(!openssl_pkcs12_read($content, $result, $password)) {
            throw new RuntimeException(OpenSSL::getLastError());
        }

        $pkcs12 = new Pkcs12();

        if(array_key_exists('cert', $result)) {
            $certificate = Certificate::createFromString($result['cert']);
            $pkcs12->setCertificate($certificate);
        }

        if(array_key_exists('pkey', $result)) {
            $privateKey = PrivateKey::loadFromString($result['pkey']);
            $pkcs12->setPrivateKey($privateKey);
        }

        if(array_key_exists('extracerts', $result)) {
            $chain = new Chain($result['extracerts']);
            $pkcs12->setChain($chain);
        }

        return $pkcs12;
    }
389923
public function sign($content) {
        if (is_array($content)) {
            $content = $this->getSignContent($content);
        }
        $sign_flag = openssl_sign($content,
            $signature,
            $this->privateKey['pkey'],
            OPENSSL_ALGO_SHA512);
        if (!$sign_flag) {
            throw new \Exception('签名失败！');
        }
        return base64_encode($signature);
    }
186592
public function handle(?string $content = null): string
    {
        return trim((string) preg_replace('/\s+/', ' ', $this->ipsum));
    }
1024232
public static function encodeShortcode($content)
    {
        $content = self::entitiesToUnicode($content);
        $content = self::unicodeToShortcode($content);

        return $content;
    }
372083
public function doShortcode($content)
    {
        if (false === strpos($content, '[')) {
            return $content;
        }

        if (empty($this->_shortcodes) || !is_array($this->_shortcodes))
            return $content;

        /**
         * Clear content from ignore blocks
         */
        $pattern = $this->getIgnorePattern();
        $content = preg_replace_callback("~$pattern~isu", ['self', '_stack'], $content);

        /**
         * parse nested
         */
        $content = $this->parseContent($content);

        /**
         * Replase shorcodes in content
         */
        $content = strtr($content, self::_stack());

        return $content;
    }