PHP Function Reference

PHP hash_update() Function



The PHP hash_update() function is used to pump data into an active hashing context.

Syntax

hash_update(context, data)

Parameters

context Required. Specify hashing context returned by hash_init().
data Required. Specify message to be included in the hash digest.

Return Value

Returns true.

Example: hash_update() example

The example below shows the usage of hash_update() function.

<?php
//initializing an incremental hashing context
$ctx = hash_init('md5');

//updating context
hash_update($ctx, 'The quick brown fox ');

//updating context one more time
hash_update($ctx, 'jumped over the lazy dog.');

//finalizing an incremental hash
//and returning resulting digest
echo hash_final($ctx);
?>

The output of the above code will be:

5c6ffbdd40d9556b73a21e63c3e0e904

❮ PHP Hash Reference