hash_final

(PHP 5 >= 5.1.2, PHP 7, PECL hash >= 1.1)

hash_final结束增量哈希,并且返回摘要结果

说明

hash_final ( HashContext $context [, bool $raw_output = FALSE ] ) : string

参数

context

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

raw_output

设置为 TRUE,输出格式为原始的二进制数据。 设置为 FALSE,输出小写的 16 进制字符串。

返回值

如果 raw_output 设置为 TRUE, 则返回原始二进制数据表示的信息摘要, 否则返回 16 进制小写字符串格式表示的信息摘要。

更新日志

版本 说明
7.2.0 接收参数从资源类型修改为 HashContext 对象类型。

范例

Example #1 hash_final() 例程

<?php
$ctx 
hash_init('sha1');
hash_update($ctx'The quick brown fox jumped over the lazy dog.');
echo 
hash_final($ctx);
?>

以上例程会输出:

c0854fb9fb03c41cce3802cb0d220529e6eef94e

参见