By configuring `file_hash` option to `random`, file deduplication is not
effective anymore but file is not hashed.
Signed-off-by: Jerome Jutteau <jerome@jutteau.fr>
* By default, files are hashed through md5 but other methods are available.
* Possible values are 'md5' and 'md5_outside'.
* With 'md5' option, the whole file is hashed through md5. This is the default.
* By default, files are hashed through md5 but other methods are available.
* Possible values are 'md5' and 'md5_outside'.
* With 'md5' option, the whole file is hashed through md5. This is the default.
- * With 'md5_outside', md5 is used to hash the first part of the file, the last part of the file
+ * With 'md5_outside', md5 is used to hash the first part of the file, the last part of the file.
+ * With 'random', file hash not set to a random value and file deduplication cannot work anymore but it is fast and safe.
* and the file's size. This method is fast for large files but cannot be perfect.
*/
$cfg['file_hash'] = 'md5';
* and the file's size. This method is fast for large files but cannot be perfect.
*/
$cfg['file_hash'] = 'md5';
- * @param $method hash method, see 'file_hash' option. 'md5' or 'md5_outside'.
+ * @param $method hash method, see 'file_hash' option. Valid methods are 'md5', 'md5_outside' or 'random'
* @param $file_path file to hash
* @returns hash string
*/
* @param $file_path file to hash
* @returns hash string
*/
return jirafeau_md5_outside($file_path);
case 'md5':
return md5_file($file_path);
return jirafeau_md5_outside($file_path);
case 'md5':
return md5_file($file_path);
+ case 'random':
+ return jirafeau_gen_random(32);
}
return md5_file($file_path);
}
}
return md5_file($file_path);
}