Summery Summery
Returns checksum for a file from starting position to absolute end position.
Syntax Syntax
Parameters Parameters
- $file
-
(Required)
- $offset
-
(Required)
- $end
-
(Required)
- $algorithm
-
(Required)
Return Return
(string|false)
Source Source
File: wp-includes/ID3/getid3.lib.php
}
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;
}
$hash = hash_final($ctx);
fclose($fp);
return $hash;
}
/**
* @param string $filename_source