文字

hash_final

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

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

说明

string hash_final ( resource $context [, bool $raw_output = false ] )

参数

context

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

raw_output

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

返回值

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

范例

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

参见

  • hash_init() - 初始化增量哈希运算上下文
  • hash_update() - 向活跃的哈希运算上下文中填充数据
  • hash_update_stream() - 从打开的流向活跃的哈希运算上下文中填充数据
  • hash_update_file() - 从文件向活跃的哈希运算上下文中填充数据
上一篇: 下一篇: