PHP | hash_final() Function
The hash_final() function is an inbuilt function in PHP which is used to finalize an incremental hash and return the resulting digest.
Syntax:
hash_final( $context, $raw_output )
Parameters: This function accept two parameters as mention above and describe below.
- $context: This parameter is used to specify the hashing context returned by hash_init() function
- $raw_output: This parameter is used to set Boolean value. If this parameter set to True then output contains raw binary data and if parameter set to False then output contains lowercase hexits.
Return Value: This function returns a string containing the calculated message digest as lowercase hexits.
Below programs illustrate the hash_final() function in PHP:
Program 1:
<?php // PHP program too illustrate // hash_final function $gfg = hash_init('md5'); hash_update($gfg, 'GeeksforGeeks A CS Portal'); // Print result return by // hash_final function print(hash_final($gfg)); ?> |
a26b1748ffd7e4c9923336a3c8e9a4c3
Program 2:
<?php // PHP program too illustrate // hash_final function $gfg = hash_init('md5'); hash_update($gfg, 'GeeksforGeeks A CS Portal'); // Print result return by // hash_final function print(hash_final($gfg, false)); ?> |
a26b1748ffd7e4c9923336a3c8e9a4c3
Reference: http://php.net/manual/en/function.hash-final.php#refsect1-function.hash-final-parameters
Recommended Posts:
- How to call a function that return another function in JavaScript ?
- How to get the function name inside a function in PHP ?
- How to get the function name from within that function using JavaScript ?
- PHP | Ds\Set xor() Function
- D3.js | d3.max() function
- PHP | pow( ) Function
- PHP | Ds\Map xor() Function
- PHP | Ds\Set add() Function
- PHP | each() Function
- PHP | Ds\Map put() Function
- PHP | key() Function
- CSS | rgb() Function
- PHP | min( ) Function
- PHP | pos() Function
- p5.js | hex() function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




