I've been searching & googling a lot about this question, and I already know how to compare two files (hashes, checksums, etc.). But it's not quite what I need. What I need is described below.
Lets assume I have a file and I've backuped it. Later I've made some changes to this file, so I want to apply changes to the backup version. Since two files can be big enought and changes can be small, I don't want to rewrite all the file, because I'm planning to backup it though the internet (maybe FTP) wich can take a lot of time.
How I see this (sample):
Backup version of file (bytes)
134 253 637 151
Newer version of file (bytes)
134 624 151 890
Instead of rewriting all bytes, we should:
253
to 624
(change bytes)637
bytes (remove bytes)890
at the end of file (insert bytes)The 1,2,3 options do not necessarily appear at once in each case. Note that the backup file could be located somewhere else, and I only have acces to it through the internet (server could return something so we can compare files).
How can I achive this? I know it's possible cause I know software where it's implemented (but couldn't find out how). Any hints, tutorials, etc. is welcomed and highly appriciated. Thanks in advance.
You're trying to solve the same problem that every MMORPG has solved... creating and applying small patch files to update older versions of large binaries.
This is a well-studied problem and there are a number of solutions out there. For several existing options, see
Binary patch-generation in C#
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With