Skip to content

jue89/tiny-vcdiff

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🗜️ tiny-vcdiff

This is a library for decoding binary delta files that have been generated by open-vcdiff in the interleaved format.

It has been designed to run on constraint devices with just a few kB of RAM.

Walkthrough

This example shows how binary deltas are created and applied.

Make sure to install build tools before running the commands down below. Common Linux distributions:

  • Debian/Ubuntu: apt install build-essential git cmake
  • Arch: pacman -S base-devel git cmake
  • Alpine: apk add alpine-sdk cmake
# 1. Clone and compile open-vcdiff
git clone --recurse-submodules https://github.com/google/open-vcdiff.git
mkdir open-vcdiff/build
cd open-vcdiff/build
cmake ..
make
cd ../..

# 2. Clone and compile tiny-vcdiff
git clone https://github.com/jue89/tiny-vcdiff.git
cd tiny-vcdiff
make
cd ..

# 3. Generate diff
echo "Hello world! I hope you are doing well ..." >old
echo "Hello universe! I hope you are doing well ..." >new
./open-vcdiff/build/vcdiff delta -interleaved -dictionary old <new >diff
./tiny-vcdiff/vcdiff-decode -i old <diff >new-reconstructed

# 4. Compare the reconstructed file
sha256sum new*

Adopting the library

Of course, most constraint devices don't offer a POSIX interface for compiling and running the vcdiff-decoder tool that is shipped with this library.

The Library needs access to the old binary (called source) and to the new binary (called target). This is achieved with an implementation of the vcdiff_driver_t struct that include/vcdiff.h defines for each of them.

tools/vcdiff-decoder.c shows a minimal implementation for the target (a pipe) in L31-64 and for the source (a file) in L66-85. Both drivers are wired-up with the library in L96 and L97.

Once everything is in place, the binary delta can be fed into the library (L101). The delta can be split into chunks of arbitrary size. Applying the delta byte-by-byte is valid use of the library!

About

Decoder for open-vcdiff interleaved deltas

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published