hash_final()


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

Description

hash_final() finalizes an incremental hash and return resulting digest

※ available F/W version : all

Parameters

Return values

Returns a string containing the calculated message digest as lowercase hexits unless $raw_output is set to true, in which case, the raw binary representation of the message digest is returned.

Example

<?php
$data1 = "abcdefg";
$data2 = "hijklmn";

$context = hash_init("md5");
hash_update($context, $data1);
hash_update($context, $data2);
$hash_value = hash_final($context, true);

hexdump($hash_value);
// OUTPUT: 0000  08 45 a5 97 2c d9 ad 4a  46 ba d6 6f 12 53 58 1f  |.E..,..JF..o.SX.|
?>

See also

hash() / hash_init() / hash_update() / hash_hmac()

Remarks

hash_final () is identical to PHP group’s hash_final function.