<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.openssl.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'function.openssl-digest.php',
    1 => 'openssl_digest',
    2 => '计算摘要',
  ),
  'up' => 
  array (
    0 => 'ref.openssl.php',
    1 => 'OpenSSL 函数',
  ),
  'prev' => 
  array (
    0 => 'function.openssl-dh-compute-key.php',
    1 => 'openssl_dh_compute_key',
  ),
  'next' => 
  array (
    0 => 'function.openssl-encrypt.php',
    1 => 'openssl_encrypt',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'zh',
    'path' => 'reference/openssl/functions/openssl-digest.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.openssl-digest" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">openssl_digest</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.3.0, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">openssl_digest</span> &mdash; <span class="dc-title">计算摘要</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.openssl-digest-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>openssl_digest</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$data</code></span>, <span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$digest_algo</code></span>, <span class="methodparam"><span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span> <code class="parameter">$binary</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong></span></span>): <span class="type"><span class="type"><a href="language.types.string.php" class="type string">string</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></span></div>

  <p class="para rdfs-comment">
   使用给定的方法计算给定数据的摘要哈希值，并返回一个原始的或16进制编码的字符串。
  </p>

 </div>


 <div class="refsect1 parameters" id="refsect1-function.openssl-digest-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">data</code></dt>
     <dd>
      <p class="para">
       给定的数据。
      </p>
     </dd>
    
    
     <dt><code class="parameter">digest_algo</code></dt>
     <dd>
      <p class="para">
       要使用的摘要方法，比如 &quot;sha256&quot;, 查看 <span class="function"><a href="function.openssl-get-md-methods.php" class="function">openssl_get_md_methods()</a></span> 函数获取更多可用的摘要方法。
      </p>
     </dd>
    
    
     <dt><code class="parameter">binary</code></dt>
     <dd>
      <p class="para">
       为 <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> 时将会返回原始输出数据，否则返回值将会是16进制。
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.openssl-digest-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   成功，返回摘要哈希值， 或者在失败时返回 <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>.
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-function.openssl-digest-errors">
  <h3 class="title">错误／异常</h3>
  <p class="para">
   如果通过 <code class="parameter">digest_algo</code> 参数传递的是未知的摘要算法，将会抛出 <strong><code><a href="errorfunc.constants.php#constant.e-warning">E_WARNING</a></code></strong> 级的错误。
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.openssl-digest-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.openssl-get-md-methods.php" class="function" rel="rdfs-seeAlso">openssl_get_md_methods()</a> - 获取可用的摘要算法</span></li>
   </ul>
  </p>
 </div>


</div><?php manual_footer($setup); ?>