ZsyncMake { static int weakChecksumLength(long fileLength, int blocksize, int sequenceMatches) { final double d = (Math.log(fileLength) + Math.log(blocksize)) / Math.log(2) - 8.6; final int l = (int) Math.ceil(d / sequenceMatches / 8); return l > 4 ? 4 : (l < 2 ? 2 : l); } ZsyncMake(); Path make(Path inputFile); Result writeToStream(Path inputFile, OutputStream outputStream); Result writeToStream(Path inputFile, OutputStream outputStream, Options options); FileResult writeToFile(Path inputFile); FileResult writeToFile(Path inputFile, Path outputFile); FileResult writeToFile(Path inputFile, Options options); FileResult writeToFile(Path inputFile, Path outputFile, Options options); Result writeToChannel(Path inputFile, WritableByteChannel out, Options options); static void main(String[] args); static String ZSYNC_VERSION; }
@Test public void testWeakChecksumLength() { assertEquals(2, ZsyncMake.weakChecksumLength(1024, 2048, 2)); assertEquals(3, ZsyncMake.weakChecksumLength(389 * 1024 * 1024, 4096, 2)); assertEquals(4, ZsyncMake.weakChecksumLength(25l * 1024 * 1024 * 1024 * 1024, 4096, 2)); }