(PHP 5 >= 5.3.0, PHP 7, PHP 8)
hash_copy — 拷贝哈希运算上下文
返回哈希运算上下文的一个复本。
示例 #1 hash_copy() 示例
<?php
$context = hash_init("sha256");
hash_update($context, "The quick brown fox ");
/* 拷贝上下文资源以便继续使用 */
$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";
?>
以上示例会输出:
b29d66e56ed90cce9b0165c43fedec612b60a071974d8be4513e18580d55b5bd 68b1282b91de2c054c36629cb8dd447f12f096d3e3c587978dc2248444633483