Pump data into an active hashing context from an open stream with hash_update_stream() in PHP

Description

The following code shows how to pump data into an active hashing context from an open stream with hash_update_stream().

Example


//  ww w.  j av  a2 s  . co  m

<?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 code above generates the following result.





















Home »
  PHP Tutorial »
    Development »




Environment
Error
Hash
Include
Locale
Math
Network
Output
Reflection
PHP Regular Expressions