Bug 490028 - Extract MD5 checksum calculation into a separate class

MD5 checksum is calculated in (almost) the same way in two places:
org.eclipse.equinox.p2.internal.repository.tools.RepositoryUtilities and
org.eclipse.equinox.spi.p2.publisher.PublisherHelper.

The latter uses 4K byte buffer instead of byte-by-byte update which
makes MD5 calculation for a 300k jar file 5x faster, see bug #405716 for
more details. Due to the duplication, this has been fixed in
PublisherHelper only but not in RepositoryUtilities.

Eliminate code duplication by extracting MD5 checksum calculation into a
separate class, ChecksumProducer. To make it consimable by
org.eclipse.equinox.p2.publisher and
org.eclipse.equinox.p2.repository.tools bundles but not exposing too
much internals, move it to the x-friend'ed
org.eclipse.equinox.internal.p2.repository.helpers package of
org.eclipse.equinox.p2.repository bundle.

Change-Id: Ic8b45a47700f35af1fb69f534dec7b32a2f7714a
Signed-off-by: Mykola Nikishov <mn@mn.com.ua>
5 files changed