algo = $algo; } /** * @param resource $resource * * @return string */ public function hash($resource) { rewind($resource); $context = hash_init($this->algo); hash_update_stream($context, $resource); fclose($resource); return hash_final($context); } }