Skip to main content

binary diff and patch using the BSDIFF4-format

Project description

The code is mostly derived from cx_bsdiff (written by Anthony Tuininga, http://cx-bsdiff.sourceforge.net/). The cx_bsdiff code in turn was derived from bsdiff, the standalone utility produced for BSD which can be found at http://www.daemonology.net/bsdiff. In addition to the two functions (diff and patch) cx_bsdiff provides, this package includes:

  • an interface to the BSDIFF4-format

  • command line interfaces: bsdiff4 and bspatch4

  • tests

The bsdiff4 package defines the following high level functions:

diff(src_bytes, dst_bytes) -> bytes

Return a BSDIFF4-format patch (from src_bytes to dst_bytes) as bytes.

patch(src_bytes, patch_bytes) -> bytes

Apply the BSDIFF4-format patch_bytes to src_bytes and return the bytes.

file_diff(src_path, dst_path, patch_path)

Write a BSDIFF4-format patch (from the file src_path to the file dst_path) to the file patch_path.

file_patch(src_path, dst_path, patch_path)

Apply the BSDIFF4-format file patch_path to the file src_path and write the result to the file dst_path.

file_patch_inplace(path, patch_path)

Apply the BSDIFF4-format file patch_path to the file path in place.

Example:

>>> import bsdiff4
>>> a = 100000 * b'a'
>>> b = bytearray(a)
>>> b[100:106] = b' diff '
>>> p = bsdiff4.diff(a, bytes(b))
>>> len(p)
154
>>> bsdiff4.patch(a, p) == b
True

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bsdiff4-1.2.3.tar.gz (13.1 kB view hashes)

Uploaded Source

Built Distributions

bsdiff4-1.2.3-pp39-pypy39_pp73-win_amd64.whl (18.9 kB view hashes)

Uploaded PyPy Windows x86-64

bsdiff4-1.2.3-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (16.9 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

bsdiff4-1.2.3-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (17.5 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ ARM64

bsdiff4-1.2.3-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (17.5 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

bsdiff4-1.2.3-pp39-pypy39_pp73-macosx_10_9_x86_64.whl (15.7 kB view hashes)

Uploaded PyPy macOS 10.9+ x86-64

bsdiff4-1.2.3-pp38-pypy38_pp73-win_amd64.whl (18.9 kB view hashes)

Uploaded PyPy Windows x86-64

bsdiff4-1.2.3-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (16.9 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

bsdiff4-1.2.3-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (17.5 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ ARM64

bsdiff4-1.2.3-pp38-pypy38_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (17.5 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

bsdiff4-1.2.3-pp38-pypy38_pp73-macosx_10_9_x86_64.whl (15.7 kB view hashes)

Uploaded PyPy macOS 10.9+ x86-64

bsdiff4-1.2.3-pp37-pypy37_pp73-win_amd64.whl (18.9 kB view hashes)

Uploaded PyPy Windows x86-64

bsdiff4-1.2.3-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (16.9 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

bsdiff4-1.2.3-pp37-pypy37_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (17.5 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ ARM64

bsdiff4-1.2.3-pp37-pypy37_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (17.5 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

bsdiff4-1.2.3-pp37-pypy37_pp73-macosx_10_9_x86_64.whl (15.7 kB view hashes)

Uploaded PyPy macOS 10.9+ x86-64

bsdiff4-1.2.3-cp311-cp311-win_amd64.whl (18.9 kB view hashes)

Uploaded CPython 3.11 Windows x86-64

bsdiff4-1.2.3-cp311-cp311-win32.whl (17.8 kB view hashes)

Uploaded CPython 3.11 Windows x86

bsdiff4-1.2.3-cp311-cp311-musllinux_1_1_x86_64.whl (36.8 kB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.1+ x86-64

bsdiff4-1.2.3-cp311-cp311-musllinux_1_1_s390x.whl (37.1 kB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.1+ s390x

bsdiff4-1.2.3-cp311-cp311-musllinux_1_1_ppc64le.whl (39.2 kB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.1+ ppc64le

bsdiff4-1.2.3-cp311-cp311-musllinux_1_1_i686.whl (39.2 kB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.1+ i686

bsdiff4-1.2.3-cp311-cp311-musllinux_1_1_aarch64.whl (37.0 kB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.1+ ARM64

bsdiff4-1.2.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (33.3 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

bsdiff4-1.2.3-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl (33.9 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ s390x

bsdiff4-1.2.3-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (35.7 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ppc64le

bsdiff4-1.2.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (33.8 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ARM64

bsdiff4-1.2.3-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (36.0 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

bsdiff4-1.2.3-cp311-cp311-macosx_11_0_arm64.whl (16.2 kB view hashes)

Uploaded CPython 3.11 macOS 11.0+ ARM64

bsdiff4-1.2.3-cp311-cp311-macosx_10_9_x86_64.whl (16.4 kB view hashes)

Uploaded CPython 3.11 macOS 10.9+ x86-64

bsdiff4-1.2.3-cp311-cp311-macosx_10_9_universal2.whl (23.1 kB view hashes)

Uploaded CPython 3.11 macOS 10.9+ universal2 (ARM64, x86-64)

bsdiff4-1.2.3-cp310-cp310-win_amd64.whl (18.9 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

bsdiff4-1.2.3-cp310-cp310-win32.whl (17.8 kB view hashes)

Uploaded CPython 3.10 Windows x86

bsdiff4-1.2.3-cp310-cp310-musllinux_1_1_x86_64.whl (35.3 kB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.1+ x86-64

bsdiff4-1.2.3-cp310-cp310-musllinux_1_1_s390x.whl (35.6 kB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.1+ s390x

bsdiff4-1.2.3-cp310-cp310-musllinux_1_1_ppc64le.whl (37.4 kB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.1+ ppc64le

bsdiff4-1.2.3-cp310-cp310-musllinux_1_1_i686.whl (37.5 kB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.1+ i686

bsdiff4-1.2.3-cp310-cp310-musllinux_1_1_aarch64.whl (35.4 kB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.1+ ARM64

bsdiff4-1.2.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (31.5 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

bsdiff4-1.2.3-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl (32.0 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ s390x

bsdiff4-1.2.3-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (34.1 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ ppc64le

bsdiff4-1.2.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (32.1 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ ARM64

bsdiff4-1.2.3-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (34.3 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

bsdiff4-1.2.3-cp310-cp310-macosx_11_0_arm64.whl (16.2 kB view hashes)

Uploaded CPython 3.10 macOS 11.0+ ARM64

bsdiff4-1.2.3-cp310-cp310-macosx_10_9_x86_64.whl (16.4 kB view hashes)

Uploaded CPython 3.10 macOS 10.9+ x86-64

bsdiff4-1.2.3-cp310-cp310-macosx_10_9_universal2.whl (23.1 kB view hashes)

Uploaded CPython 3.10 macOS 10.9+ universal2 (ARM64, x86-64)

bsdiff4-1.2.3-cp39-cp39-win_amd64.whl (18.9 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

bsdiff4-1.2.3-cp39-cp39-win32.whl (17.8 kB view hashes)

Uploaded CPython 3.9 Windows x86

bsdiff4-1.2.3-cp39-cp39-musllinux_1_1_x86_64.whl (35.1 kB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.1+ x86-64

bsdiff4-1.2.3-cp39-cp39-musllinux_1_1_s390x.whl (35.3 kB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.1+ s390x

bsdiff4-1.2.3-cp39-cp39-musllinux_1_1_ppc64le.whl (37.2 kB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.1+ ppc64le

bsdiff4-1.2.3-cp39-cp39-musllinux_1_1_i686.whl (37.3 kB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.1+ i686

bsdiff4-1.2.3-cp39-cp39-musllinux_1_1_aarch64.whl (35.2 kB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.1+ ARM64

bsdiff4-1.2.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (31.3 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

bsdiff4-1.2.3-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl (31.8 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ s390x

bsdiff4-1.2.3-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (33.9 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ ppc64le

bsdiff4-1.2.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (31.8 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ ARM64

bsdiff4-1.2.3-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (34.1 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

bsdiff4-1.2.3-cp39-cp39-macosx_11_0_arm64.whl (16.2 kB view hashes)

Uploaded CPython 3.9 macOS 11.0+ ARM64

bsdiff4-1.2.3-cp39-cp39-macosx_10_9_x86_64.whl (16.4 kB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

bsdiff4-1.2.3-cp39-cp39-macosx_10_9_universal2.whl (23.1 kB view hashes)

Uploaded CPython 3.9 macOS 10.9+ universal2 (ARM64, x86-64)

bsdiff4-1.2.3-cp38-cp38-win_amd64.whl (18.9 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

bsdiff4-1.2.3-cp38-cp38-win32.whl (17.8 kB view hashes)

Uploaded CPython 3.8 Windows x86

bsdiff4-1.2.3-cp38-cp38-musllinux_1_1_x86_64.whl (35.4 kB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.1+ x86-64

bsdiff4-1.2.3-cp38-cp38-musllinux_1_1_s390x.whl (35.7 kB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.1+ s390x

bsdiff4-1.2.3-cp38-cp38-musllinux_1_1_ppc64le.whl (37.6 kB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.1+ ppc64le

bsdiff4-1.2.3-cp38-cp38-musllinux_1_1_i686.whl (37.6 kB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.1+ i686

bsdiff4-1.2.3-cp38-cp38-musllinux_1_1_aarch64.whl (35.5 kB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.1+ ARM64

bsdiff4-1.2.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (32.0 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

bsdiff4-1.2.3-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl (32.5 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ s390x

bsdiff4-1.2.3-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (34.6 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ ppc64le

bsdiff4-1.2.3-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (32.5 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ ARM64

bsdiff4-1.2.3-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (34.7 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

bsdiff4-1.2.3-cp38-cp38-macosx_11_0_arm64.whl (16.2 kB view hashes)

Uploaded CPython 3.8 macOS 11.0+ ARM64

bsdiff4-1.2.3-cp38-cp38-macosx_10_9_x86_64.whl (16.4 kB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

bsdiff4-1.2.3-cp38-cp38-macosx_10_9_universal2.whl (23.1 kB view hashes)

Uploaded CPython 3.8 macOS 10.9+ universal2 (ARM64, x86-64)

bsdiff4-1.2.3-cp37-cp37m-win_amd64.whl (18.9 kB view hashes)

Uploaded CPython 3.7m Windows x86-64

bsdiff4-1.2.3-cp37-cp37m-win32.whl (17.7 kB view hashes)

Uploaded CPython 3.7m Windows x86

bsdiff4-1.2.3-cp37-cp37m-musllinux_1_1_x86_64.whl (35.6 kB view hashes)

Uploaded CPython 3.7m musllinux: musl 1.1+ x86-64

bsdiff4-1.2.3-cp37-cp37m-musllinux_1_1_s390x.whl (35.8 kB view hashes)

Uploaded CPython 3.7m musllinux: musl 1.1+ s390x

bsdiff4-1.2.3-cp37-cp37m-musllinux_1_1_ppc64le.whl (37.7 kB view hashes)

Uploaded CPython 3.7m musllinux: musl 1.1+ ppc64le

bsdiff4-1.2.3-cp37-cp37m-musllinux_1_1_i686.whl (37.9 kB view hashes)

Uploaded CPython 3.7m musllinux: musl 1.1+ i686

bsdiff4-1.2.3-cp37-cp37m-musllinux_1_1_aarch64.whl (35.6 kB view hashes)

Uploaded CPython 3.7m musllinux: musl 1.1+ ARM64

bsdiff4-1.2.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (32.4 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

bsdiff4-1.2.3-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl (33.0 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ s390x

bsdiff4-1.2.3-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (34.9 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ ppc64le

bsdiff4-1.2.3-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (33.0 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ ARM64

bsdiff4-1.2.3-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (35.1 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

bsdiff4-1.2.3-cp37-cp37m-macosx_10_9_x86_64.whl (16.4 kB view hashes)

Uploaded CPython 3.7m macOS 10.9+ x86-64

bsdiff4-1.2.3-cp36-cp36m-win_amd64.whl (19.0 kB view hashes)

Uploaded CPython 3.6m Windows x86-64

bsdiff4-1.2.3-cp36-cp36m-win32.whl (17.8 kB view hashes)

Uploaded CPython 3.6m Windows x86

bsdiff4-1.2.3-cp36-cp36m-musllinux_1_1_x86_64.whl (34.8 kB view hashes)

Uploaded CPython 3.6m musllinux: musl 1.1+ x86-64

bsdiff4-1.2.3-cp36-cp36m-musllinux_1_1_s390x.whl (35.0 kB view hashes)

Uploaded CPython 3.6m musllinux: musl 1.1+ s390x

bsdiff4-1.2.3-cp36-cp36m-musllinux_1_1_ppc64le.whl (36.8 kB view hashes)

Uploaded CPython 3.6m musllinux: musl 1.1+ ppc64le

bsdiff4-1.2.3-cp36-cp36m-musllinux_1_1_i686.whl (37.0 kB view hashes)

Uploaded CPython 3.6m musllinux: musl 1.1+ i686

bsdiff4-1.2.3-cp36-cp36m-musllinux_1_1_aarch64.whl (34.8 kB view hashes)

Uploaded CPython 3.6m musllinux: musl 1.1+ ARM64

bsdiff4-1.2.3-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (31.4 kB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.17+ x86-64

bsdiff4-1.2.3-cp36-cp36m-manylinux_2_17_s390x.manylinux2014_s390x.whl (32.0 kB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.17+ s390x

bsdiff4-1.2.3-cp36-cp36m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (33.9 kB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.17+ ppc64le

bsdiff4-1.2.3-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (32.0 kB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.17+ ARM64

bsdiff4-1.2.3-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (34.2 kB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

bsdiff4-1.2.3-cp36-cp36m-macosx_10_9_x86_64.whl (16.4 kB view hashes)

Uploaded CPython 3.6m macOS 10.9+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page