bsdiff and bspatch are command line tools for building and applying patches to binary files. It creates and applies BDF patches.
By using suffix sorting (specifically, Larsson and Sadakane’s qsufsort) and taking advantage of how executable files change, bsdiff routinely produces binary patches 50-80% smaller than those produced by Xdelta, and 15% smaller than those produced by .RTPatch (a $2750/seat commercial patch tool).
The algorithm used by BSDiff 4 is described in the (unpublished) paper Naive differences of executable code;.
To apply “patch.bdf” on the file “bad.aaa”, generating “good.aaa” just type: bspatch bad.aaa good.aaa patch.bdf
To create “”patch.bdf” that generates “good.aaa” from original “bad.aaa”, just type: bsdiff bad.aaa good.aaa patch.bdf