<?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 => 'en',
  ),
  'this' => 
  array (
    0 => 'function.hash-copy.php',
    1 => 'hash_copy',
    2 => 'Copy hashing context',
  ),
  'up' => 
  array (
    0 => 'ref.hash.php',
    1 => 'Hash Functions',
  ),
  'prev' => 
  array (
    0 => 'function.hash-algos.php',
    1 => 'hash_algos',
  ),
  'next' => 
  array (
    0 => 'function.hash-equals.php',
    1 => 'hash_equals',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/hash/functions/hash-copy.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.hash-copy" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">hash_copy</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.3.0, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">hash_copy</span> &mdash; <span class="dc-title">Copy hashing context</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.hash-copy-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>hash_copy</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="type"><a href="class.hashcontext.php" class="type HashContext">HashContext</a></span></div>

 </div>


 <div class="refsect1 parameters" id="refsect1-function.hash-copy-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">context</code></dt>
     <dd>
      <p class="para">
       Hashing context returned by <span class="function"><a href="function.hash-init.php" class="function">hash_init()</a></span>.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.hash-copy-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns a copy of Hashing Context.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.hash-copy-changelog">
  <h3 class="title">Changelog</h3>
  <p class="para">
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>Version</th>
       <th>Description</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>7.2.0</td>
       <td>
        Accept and return <span class="classname"><a href="class.hashcontext.php" class="classname">HashContext</a></span> instead of resource.
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>

 
 <div class="refsect1 examples" id="refsect1-function.hash-copy-examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Example #1 <span class="function"><strong>hash_copy()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$context </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">$context</span><span style="color: #007700">, </span><span style="color: #DD0000">"The quick brown fox "</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">/* copy context to be able to continue using it */<br /></span><span style="color: #0000BB">$copy_context </span><span style="color: #007700">= </span><span style="color: #0000BB">hash_copy</span><span style="color: #007700">(</span><span style="color: #0000BB">$context</span><span style="color: #007700">);<br /><br />echo </span><span style="color: #0000BB">hash_final</span><span style="color: #007700">(</span><span style="color: #0000BB">$context</span><span style="color: #007700">), </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">hash_update</span><span style="color: #007700">(</span><span style="color: #0000BB">$copy_context</span><span style="color: #007700">, </span><span style="color: #DD0000">"jumped over the lazy dog."</span><span style="color: #007700">);<br />echo </span><span style="color: #0000BB">hash_final</span><span style="color: #007700">(</span><span style="color: #0000BB">$copy_context</span><span style="color: #007700">), </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    <div class="example-contents"><p>The above example will output:</p></div>
    <div class="example-contents screen">
<div class="annotation-interactive examplescode"><pre class="examplescode">b29d66e56ed90cce9b0165c43fedec612b60a071974d8be4513e18580d55b5bd
68b1282b91de2c054c36629cb8dd447f12f096d3e3c587978dc2248444633483</pre>
</div>
    </div>
   </div>
  </p>
 </div>


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