BSDIFF40 binary diff and patch in pure OCaml
0

Configure Feed

Select the types of activity you want to include in your feed.

OCaml 63.7%
C 26.3%
C++ 2.9%
Shell 1.3%
Roff 1.2%
Dune 0.8%
Other 3.7%
50 1 0

Clone this repository

https://git.vm.fail/gazagnaire.org/ocaml-bsdiff https://git.vm.fail/did:plc:fp3qfrcizd4pptd6sx3765lw
ssh://git@git.recoil.org:2222/gazagnaire.org/ocaml-bsdiff ssh://git@git.recoil.org:2222/did:plc:fp3qfrcizd4pptd6sx3765lw

For self-hosted knots, clone URLs may differ based on your setup.


README.md

bsdiff#

BSDIFF40 binary diff and patch in pure OCaml.

Overview#

BSDIFF40 is the patch format of Colin Percival's bsdiff and bspatch tools: a header, then three bzip2 streams holding control triples, byte-wise difference data and extra data. The matcher -- a qsufsort suffix array over the source -- aligns regions that differ by small per-byte deltas at stable offsets, which makes the format excel on executables. Patches produced here apply with the reference bspatch, and patches produced by the reference bsdiff apply here; the interop suite replays a committed reference patch, and bench/check_tools.ml checks both directions against the installed tools.

For text-like data where regions are either identical or replaced wholesale, the vcdiff package usually produces smaller patches.

Installation#

$ opam install bsdiff

If opam cannot find the package, it may not yet be released in the public opam-repository. Add the overlay repository, then install it:

$ opam repo add samoht https://tangled.org/gazagnaire.org/opam-overlay.git
$ opam update
$ opam install bsdiff

Usage#

# let source = "the quick brown fox jumps over the lazy dog" in
  let target = "the quick brown cat jumps over the lazy dog!" in
  let patch = Bsdiff.diff ~source ~target in
  Bsdiff.apply_exn ~source patch = target;;
- : bool = true

License#

ISC -- the qsufsort construction and the matcher are ported from the BSD-licensed reference bsdiff.c, Copyright 2003-2005 Colin Percival. See LICENSE.md.