File-RsyncP

 view release on metacpan or  search on metacpan

Digest/Digest.pm  view on Meta::CPAN


=item *

MD4 is not correct for total data sizes greater than 512MB (2^32 bits).
Rsync's MD4 only maintains the data size using a 32 bit counter, so
it overflows for file sizes bigger than 512MB.

=back

The effects of these bugs are benign: the MD4 digest should not be
cryptographically weakened and both sides are consistent. 

This module implements both versions of the MD4 digest: the 
buggy version for protocol versions <= 26 and the correct
version for protocol versions >= 27.  The default mode is
the buggy version (protocol versions <= 26).

You can specify the rsync protocol version to determine which
MD4 version is used:

    # specify rsync protocol version (default is <= 26 -> buggy digests).

Digest/Digest.pm  view on Meta::CPAN


    $digests = $rsDigest->blockDigestUpdate($state, $blockSize,
                                $blockLastLen, $md4DigestLen, $checksumSeed);

The first argument is the cached checksums from blockDigest.  The
third argument is the length of the (partial) last block.

Alternatively, I hope to add a --checksum-seed=n option to rsync that allows
the checksum seed to be set to 0.  This causes the checksum seed to be
omitted from the MD4 calculation and it makes caching the checksums much
easier.  A zero checksum seed does not weaken the block digest.
I'm not sure whether or not it weakens the file digest (the checksum
seed is applied at the start of the file digest and end of the block
digest).  In this case, the full 16 byte checksums should be computed
using:

    $digests16 = $rsDigest->blockDigest($data, $blockSize, 16, 0);

and for phase 1 the 2 byte MD4 substrings can be extracted with:

    $digests2  = $rsDigest->blockDigestExtract($digests16, 2);



( run in 0.339 second using v1.01-cache-2.11-cpan-a9ef4e587e4 )