hash_copy

Copy hashing context

Syntax

hash_copy(HashContext $context): HashContext

Parameters

context

Hashing context returned by hash_init().

Return

Returns a copy of Hashing Context.

Examples

1

<?

$context = hash_init('sha384');

hash_update($context, 'Hello');

$return = hash_copy($context);

echo hash_final($context) . PHP_EOL . hash_final($return);

?>
3519fe5ad2c596efe3e276a6f351b8fc0b03db861782490d45f7598ebd0ab5fd5520ed102f38c4a5ec834e98668035fc
3519fe5ad2c596efe3e276a6f351b8fc0b03db861782490d45f7598ebd0ab5fd5520ed102f38c4a5ec834e98668035fc

2

<?

$context = hash_init('sha384');

hash_update($context, 'Hello');

$return = hash_copy($context);

echo hash_final($context) . PHP_EOL;

hash_update($return, 'Hello');

echo hash_final($return);

?>
3519fe5ad2c596efe3e276a6f351b8fc0b03db861782490d45f7598ebd0ab5fd5520ed102f38c4a5ec834e98668035fc
d5a1a1d24066bb4d99592b156be3b0820f3e36cd48efaaed749bc83ade92a75637fcc9c816fd2433989eac77fcfd0f0b
HomeMenu