array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'ja', ), 'this' => array ( 0 => 'function.hash-update-stream.php', 1 => 'hash_update_stream', ), 'up' => array ( 0 => 'ref.hash.php', 1 => 'Hash 関数', ), 'prev' => array ( 0 => 'function.hash-update-file.php', 1 => 'hash_update_file', ), 'next' => array ( 0 => 'function.hash-update.php', 1 => 'hash_update', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'ja', 'path' => 'reference/hash/functions/hash-update-stream.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 5 >= 5.1.2, PHP 7, PHP 8, PECL hash >= 1.1)
hash_update_stream — アクティブなハッシュコンテキストに、オープンしているストリームから データを投入する
context
hash_init() が返すハッシュコンテキスト。
stream
ストリーム作成用の関数が返す、オープンしているファイルハンドル。
length
stream
からハッシュコンテキストにコピーする
最大文字数。
stream
からハッシュコンテキストに追加された
実際のバイト数を返します。
例1 hash_update_stream() の例
<?php
$fp = tmpfile();
fwrite($fp, 'jumped over the lazy dog.');
rewind($fp);
$ctx = hash_init('sha256');
hash_update($ctx, 'The quick brown fox ');
hash_update_stream($ctx, $fp);
echo hash_final($ctx);
?>
上の例の出力は以下となります。
68b1282b91de2c054c36629cb8dd447f12f096d3e3c587978dc2248444633483