organizrnginxsonarrradarrplexdashboardcouchpotatonzbgetbookmarkapplication-dashboardmuximuxlandingpagestartpagelandinghtpcserverhomepagesabnzbdheimdallemby
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
593 B
36 lines
593 B
<?php
|
|
|
|
namespace League\Flysystem\Util;
|
|
|
|
class StreamHasher
|
|
{
|
|
/**
|
|
* @var string
|
|
*/
|
|
private $algo;
|
|
|
|
/**
|
|
* StreamHasher constructor.
|
|
*
|
|
* @param string $algo
|
|
*/
|
|
public function __construct($algo)
|
|
{
|
|
$this->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);
|
|
}
|
|
}
|
|
|