[−][src]Function librsyncr::calculate_signature_with_sizes
pub fn calculate_signature_with_sizes<R: Read, W: Write>(
old_file: R,
sig_file: W,
block_size: u32,
strong_sum_size: Option<u32>
) -> Result<()>
Calculates the signature file from an old version of a file.
The signature file contains a weak sum and strong sum (currently Blake2b) for each block in the old file.
Using a smaller block_size
results in more blocks and a larger signature file. However, with
randomly distributed differences, it will also make it more likely that matching blocks can be
found when generating the delta file, producing a smaller delta file.
Using a smaller strong_sum_size
results in a smaller signature file, but if it is small enough
that it results in a collision, then an invalid delta file could be produced that results in a
corrupt new file. If None
, a default of 32 is used. Using 16 is fine, but you should check the
odds of a collision before using smaller than that.