array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'fr', ), 'this' => array ( 0 => 'function.hash-copy.php', 1 => 'hash_copy', ), 'up' => array ( 0 => 'ref.hash.php', 1 => 'Fonctions Hash', ), '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' => 'fr', 'path' => 'reference/hash/functions/hash-copy.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
hash_copy — Copie un contexte de hachage
Retourne une copie du contexte de hachage Hashing Context.
Version | Description |
---|---|
7.2.0 | Accepte et retourne une classe HashContext au lieu d'une ressource. |
Exemple #1 Exemple avec hash_copy()
<?php
$context = hash_init("sha256");
hash_update($context, "The quick brown fox ");
/* copie le contexte afin de pouvoir continuer à l'utiliser */
$copy_context = hash_copy($context);
echo hash_final($context), "\n";
hash_update($copy_context, "jumped over the lazy dog.");
echo hash_final($copy_context), "\n";
?>
L'exemple ci-dessus va afficher :
b29d66e56ed90cce9b0165c43fedec612b60a071974d8be4513e18580d55b5bd 68b1282b91de2c054c36629cb8dd447f12f096d3e3c587978dc2248444633483