Speed up development with full-stack environments for every branch.

Learn More

Copy hash context [PHP]

25 Runs 95 Views 5 Copies


gtsolutions 373

published 4 years ago

 * PHP hash - Copy hash context

//Name of selected hashing algorithm (i.e. "md5", "sha256", "haval160,4", etc..) 
$algo = 'sha256';
$context = hash_init($algo);
hash_update($context, "data");

/* copy context to be able to continue using it */
$copy_context = hash_copy($context);

echo hash_final($context), "<br />";

hash_update($copy_context, "data");
echo hash_final($copy_context), "<br />";
Please login/signup to get access to the terminal.

Your session has timed out.

Dismiss (the page may not function properly).