Deprecated: Optional parameter $keys declared before required parameter $cms_id is implicitly treated as a required parameter in /home/www/dev/work/class/blog/CmsKey.php on line 75

Deprecated: Creation of dynamic property lvesu\lvesu\controller\blog\php::$title is deprecated in /home/www/dev/work/website/lvesu/class/controller/blog/php.php on line 28

Deprecated: Creation of dynamic property lvesu\lvesu\controller\blog\php::$outlink is deprecated in /home/www/dev/work/website/lvesu/template/blog/cms/php.manual.tpl on line 2

Deprecated: Creation of dynamic property lvesu\lvesu\controller\blog\php::$status is deprecated in /home/www/dev/work/website/lvesu/template/blog/index.head.php on line 2
PHP - Manual: hash_copy - 互联网笔记

略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: hash_copy

2025-04-26

hash_copy

(PHP 5 >= 5.3.0, PHP 7, PHP 8)

hash_copy拷贝哈希运算上下文

说明

hash_copy(HashContext $context): HashContext

参数

context

hash_init() 函数返回的哈希运算上下文。

返回值

返回哈希运算上下文的一个复本。

更新日志

版本 说明
7.2.0 接受的参数以及返回值从资源类型修改为 HashContext 对象类型。

示例

示例 #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
添加备注

用户贡献的备注

此页面尚无用户贡献的备注。

官方地址:https://www.php.net/manual/en/function.hash-copy.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3