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 function returns a copy of Hashing Context.
Below programs illustrate the hash_copy() function in PHP:
Program 1:
<?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"; ?> |
da39a3ee5e6b4b0d3255bfef95601890afd80709 adb536466977c49bebb6317891bffb77dc6e5823
Program 2:
<?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"; ?> |
d41d8cd98f00b204e9800998ecf8427e eadc14b80cd2f247f467eb6c7f45fa9b
Reference: http://php.net/manual/en/function.hash-copy.php
Recommended Posts:
- How to call a function that return another function in JavaScript ?
- How to get the function name from within that function using JavaScript ?
- D3.js | d3.set.has() Function
- p5.js | red() function
- PHP | cos( ) Function
- PHP | sin( ) Function
- PHP | tan( ) Function
- p5.js | min() function
- p5.js | tan() function
- p5.js | sin() function
- D3.js | d3.sum() function
- D3.js | d3.mean() function
- PHP | exp() Function
- PHP | Ds\Set xor() Function
- p5.js | log() 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.




