public static function hash_data($file,
$offset,
$end,
$algorithm) { if (!self::
intValueSupported($end)) { return false;
} if (!
in_array($algorithm, array
('md5', 'sha1'
))) { throw new getid3_exception('Invalid algorithm ('.
$algorithm.') in self::hash_data()'
);
} $size =
$end -
$offset;
$fp =
fopen($file, 'rb'
);
fseek($fp,
$offset);
$ctx =
hash_init($algorithm);
while ($size > 0
) { $buffer =
fread($fp,
min($size, getID3::FREAD_BUFFER_SIZE
));
hash_update($ctx,
$buffer);
$size -= getID3::FREAD_BUFFER_SIZE;
}