= 5.1.2, PHP 7, PHP 8, PECL hash >= 1.1)hash_final — 結束增量哈希,并且返回摘要結果說明hash_final(HashContext $context, bool $raw_output = false): st">
(PHP 5 >= 5.1.2, PHP 7, PHP 8, PECL hash >= 1.1)
hash_final — 結束增量哈希,并且返回摘要結果
$context
, bool $raw_output
= false
): string
context
hash_init() 函數(shù)返回的哈希運算上下文資源。
raw_output
設置為 true
,輸出格式為原始的二進制數(shù)據(jù)。
設置為 false
,輸出小寫的 16 進制字符串。
如果 raw_output
設置為 true
, 則返回原始二進制數(shù)據(jù)表示的信息摘要,
否則返回 16 進制小寫字符串格式表示的信息摘要。
版本 | 說明 |
---|---|
7.2.0 | 接收參數(shù)從資源類型修改為 HashContext 對象類型。 |
示例 #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