What's the best way to go about making a patch for a binary file? I want it to be simple for users to apply(a simple patch
application would be nice). Running diff on the file just gives Binary files [...] differ
相关问题
- Most efficient way to turn factor matrix into bina
- Cast some light on population count algorithm
- Haskell - How to create a mapTree function based o
- Upload linux binary file to maven repository
- Crystal lang how to get binary file from http
相关文章
- How to get path of the php binary on server where
- Unsigned char c = 255 is “11111111” or not?
- Is there a commonly-used filename extension for un
- Python: how to create a choropleth map out of a sh
- Reading records from a Fortran binary file in Pyth
- Java: Why doesn't binary OR work as expected (
- Reading a binary map file in r
- Load file into IMAGE object using Phantom.js
Modern port: Very useful .NET port for bsdiff/bspatch:
https://github.com/LogosBible/bsdiff.net
My personal choice. I tested it, and it was the only of all links, I was able out of the box to compile it (with Visual Studio, e.g. 2013). (The C++ source elsewhere is a bit outdated and needs at least a bit polishing and is only 32 bit which sets real memory (diff source size) limits. This is a port of this C++ code bsdiff and even tests if the patch results are identical to original code).
Further idea: With .NET 4.5 you could even get rid of #Zip lib, which is a dependency here.
I haven't measured if it is slightly slowlier than the c++ code, but it worked fine for me, (bsdiff: 90 MB file in 1-2 min.), and time-critical for me is only the bspatch, not the bsdiff.
I am not really sure, if the whole memory of a x64 machine is used, but I assume it. The x64 capable build ("Any CPU") works at least. Tried with a 100 MB file.
- Besides: The cited Google project 'Courgette' may be the best choice if your main target are executable files. But it is work to build it (for Windows measures, at least), and for binary files it is also using pure bsdiff/bspatch, as far as I have understood the doc.
xdelta is another option.
It's available on the mac via homebrew:
brew install xdelta
It seems to be more recent, but otherwise I have no idea how it compares to other tools like bsdiff.
Google Courgette tool looks like most efficient tool for binary diff patches
comparing with bsdiff - 10 times smaller patch!
Assuming you know the structure of the file you could use a c / c++ program to modify it byte by byte:
http://msdn.microsoft.com/en-us/library/c565h7xx(VS.71).aspx
Just read in the old file, and write out a new one modified as you like.
Don't forget to include a file format version number in the file so you know how to read any given version of the file format.
If using something else than the standard
patch
is an option for you, you might want to check outbsdiff
andbspatch
:http://www.daemonology.net/bsdiff/