PHP | hash_final() Function Last Updated : 11 Jul, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report 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 // PHP program to 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)); ?> Output:a26b1748ffd7e4c9923336a3c8e9a4c3 Program 2: php <?php // PHP program to 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)); ?> Output:a26b1748ffd7e4c9923336a3c8e9a4c3 Reference: https://www.php.net/manual/en/function.hash-final.php#refsect1-function.hash-final-parameters Comment More infoAdvertise with us Next Article PHP | hash_copy() Function R R_Raj Follow Improve Article Tags : Web Technologies PHP PHP-function Similar Reads PHP | hash_file( ) Function The hash_file() function is an inbuilt function in PHP which is used to generate a hash value using the contents of a given file. Syntax: string hash_file( $algo, $file, $raw_opt ) Parameters: This function accept three parameters as mention above and describe below. $algo: It is the required parame 2 min read PHP | hash_algos() Function The hash_algos() function is an inbuilt function in PHP which is used to return a list of registered hashing algorithms. Syntax: array hash_algos( void ) Parameter: This function does not accepts any parameter. Return Value: This function returns a numerically indexed array which contains the list o 2 min read PHP | hash_equals() Function The hash_equals function() is an inbuilt function in PHP which is used to compares two strings using the same time whether they are equal or not.Syntax: hash_equals( $known_str, $usr_str ) Parameters: This function accept two parameters as mention above and describe below. $known_str: This parameter 1 min read PHP | hash_hmac_file() Function The hash_hmac_file() function is an inbuilt function in PHP that is used to generate a keyed hash value using the contents of a given file. Syntax: string hash_hmac_file( $algo, $file, $key, $raw_opt ) Parameters: This function accepts four parameters as mentioned above and described below. $algo: 2 min read PHP | hash_copy() Function The hash_copy() function is an inbuilt function in PHP which is used to get the copy of hashing context. Syntax: hash_copy( $context ) Parameters: This function accepts single parameter $context which is used to specify the hashing context returned by hash_init() function. Return Value: This functio 1 min read PHP | hash_hmac_algos() Function The hash_hmac_algos() function is an inbuilt function in PHP that is used to get the list of registered hashing algorithms suitable for the hash_hmac() function. Syntax: array hash_hmac_algos( void ) Parameters: This function does not accept any parameter. Return Value: This function returns an ar 2 min read Like