PHP | hash_copy() Function Last Updated : 29 Oct, 2018 Summarize Comments Improve Suggest changes Share Like Article Like Report 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 function returns a copy of Hashing Context. Below programs illustrate the hash_copy() function in PHP: Program 1: php <?php // Initialize an incremental // hashing context $context = hash_init("sha1"); // Copy context using hash_copy function $cp_context = hash_copy($context); // Finalize an incremental hash // and return resulting digest echo hash_final($context), "\n"; // Update context hash_update($cp_context, "GFG"); // Print finalize context echo hash_final($cp_context), "\n"; ?> Output: da39a3ee5e6b4b0d3255bfef95601890afd80709 adb536466977c49bebb6317891bffb77dc6e5823 Program 2: php <?php // Initialize an incremental // hashing context $context = hash_init("md5"); // Copy context using hash_copy function $cp_context = hash_copy($context); // Finalize an incremental hash // and return resulting digest echo hash_final($context), "\n"; // Update context hash_update($cp_context, "GFG"); // Print finalize context echo hash_final($cp_context), "\n"; ?> Output: d41d8cd98f00b204e9800998ecf8427e eadc14b80cd2f247f467eb6c7f45fa9b Reference: http://php.net/manual/en/function.hash-copy.php Comment More infoAdvertise with us Next Article PHP | hash_copy() Function R R_Raj Follow Improve Article Tags : Web Technologies PHP Hash PHP-function Practice Tags : Hash Similar Reads 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_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_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 1 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() Function The hash_hmac() function is an inbuilt function in PHP which is used to generate the keyed hash value using the HMAC method. Syntax: string hash_hmac( $algo, $msg, $key, $raw_opt ) Parameters: This function accepts four parameters as mention above and describe below. $algo: It is the required parame 2 min read Like