HASH_UPDATE_STREAM(3) 1 HASH_UPDATE_STREAM(3)
hash_update_stream - Pump data into an active hashing context from an open stream
SYNOPSIS
int hash_update_stream (resource $context, resource $handle, [int $length = -1])
DESCRIPTION
PARAMETERS
o $context
- Hashing context returned by hash_init(3).
o $handle
- Open file handle as returned by any stream creation function.
o $length
- Maximum number of characters to copy from $handle into the hashing context.
RETURN VALUES
Actual number of bytes added to the hashing context from $handle.
EXAMPLES
Example #1
hash_update_stream(3) example
<?php
$fp = tmpfile();
fwrite($fp, 'The quick brown fox jumped over the lazy dog.');
rewind($fp);
$ctx = hash_init('md5');
hash_update_stream($ctx, $fp);
echo hash_final($ctx);
?>
The above example will output:
5c6ffbdd40d9556b73a21e63c3e0e904
SEE ALSO
hash_init(3), hash_update(3), hash_final(3), hash(3), hash_file(3).
PHP Documentation Group HASH_UPDATE_STREAM(3)