<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.hash.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'function.hash-update-stream.php',
    1 => 'hash_update_stream',
    2 => '从打开的流向活跃的散列运算上下文中填充数据',
  ),
  'up' => 
  array (
    0 => 'ref.hash.php',
    1 => 'Hash 函数',
  ),
  'prev' => 
  array (
    0 => 'function.hash-update-file.php',
    1 => 'hash_update_file',
  ),
  'next' => 
  array (
    0 => 'book.mcrypt.php',
    1 => 'Mcrypt',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'zh',
    'path' => 'reference/hash/functions/hash-update-stream.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.hash-update-stream" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">hash_update_stream</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.1.2, PHP 7, PHP 8, PECL hash &gt;= 1.1)</p><p class="refpurpose"><span class="refname">hash_update_stream</span> &mdash; <span class="dc-title">从打开的流向活跃的散列运算上下文中填充数据</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.hash-update-stream-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>hash_update_stream</strong></span>(<span class="methodparam"><span class="type"><a href="class.hashcontext.php" class="type HashContext">HashContext</a></span> <code class="parameter">$context</code></span>, <span class="methodparam"><span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span> <code class="parameter">$stream</code></span>, <span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$length</code><span class="initializer"> = -1</span></span>): <span class="type"><a href="language.types.integer.php" class="type int">int</a></span></div>


 </div>

 <div class="refsect1 parameters" id="refsect1-function.hash-update-stream-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">context</code></dt>
     <dd>
      <p class="para">
       由 <span class="function"><a href="function.hash-init.php" class="function">hash_init()</a></span> 函数返回的散列运算上下文。
      </p>
     </dd>
    
    
     <dt><code class="parameter">stream</code></dt>
     <dd>
      <p class="para">
       创建流的函数返回的打开的文件句柄。
      </p>
     </dd>
    
    
     <dt><code class="parameter">length</code></dt>
     <dd>
      <p class="para">
       要从 <code class="parameter">stream</code> 向活跃的散列运算上下文中拷贝的最大字符数。
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.hash-update-stream-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   从 <code class="parameter">stream</code> 向散列运算上下文中实际填充的字节数量。
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.hash-update-stream-changelog">
  <h3 class="title">更新日志</h3>
  <p class="para">
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>版本</th>
       <th>说明</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>7.2.0</td>
       <td>
        接收参数从资源类型修改为 <span class="classname"><a href="class.hashcontext.php" class="classname">HashContext</a></span> 对象类型。
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>

 
 <div class="refsect1 examples" id="refsect1-function.hash-update-stream-examples">
  <h3 class="title">示例</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>示例 #1 <span class="function"><strong>hash_update_stream()</strong></span> 示例</strong></p>
    <div class="example-contents">
<div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$fp </span><span style="color: #007700">= </span><span style="color: #0000BB">tmpfile</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">fwrite</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">, </span><span style="color: #DD0000">'jumped over the lazy dog.'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">rewind</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$ctx </span><span style="color: #007700">= </span><span style="color: #0000BB">hash_init</span><span style="color: #007700">(</span><span style="color: #DD0000">'sha256'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">hash_update</span><span style="color: #007700">(</span><span style="color: #0000BB">$ctx</span><span style="color: #007700">, </span><span style="color: #DD0000">'The quick brown fox '</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">hash_update_stream</span><span style="color: #007700">(</span><span style="color: #0000BB">$ctx</span><span style="color: #007700">, </span><span style="color: #0000BB">$fp</span><span style="color: #007700">);<br />echo </span><span style="color: #0000BB">hash_final</span><span style="color: #007700">(</span><span style="color: #0000BB">$ctx</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    <div class="example-contents"><p>以上示例会输出：</p></div>
    <div class="example-contents screen">
<div class="annotation-interactive examplescode"><pre class="examplescode">68b1282b91de2c054c36629cb8dd447f12f096d3e3c587978dc2248444633483</pre>
</div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.hash-update-stream-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.hash-init.php" class="function" rel="rdfs-seeAlso">hash_init()</a> - 初始化增量散列运算上下文</span></li>
    <li><span class="function"><a href="function.hash-update.php" class="function" rel="rdfs-seeAlso">hash_update()</a> - 向活跃的哈希运算上下文中填充数据</span></li>
    <li><span class="function"><a href="function.hash-final.php" class="function" rel="rdfs-seeAlso">hash_final()</a> - 结束增量散列且返回摘要结果</span></li>
   </ul>
  </p>
 </div>


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