Octodiff icon indicating copy to clipboard operation
Octodiff copied to clipboard

Reverse Diff?

Open finepointcgi opened this issue 4 years ago • 1 comments

Could we undo a file with octodiff that has been previously created if we have the diff files?

finepointcgi avatar Jun 24 '21 14:06 finepointcgi

Hi @finepointcgi ! We use Octodiff by:

  1. Creating a signature of file1.
  2. Creating a delta file using the signature file and file2.
  3. Patching the file1 and the delta file to re-create file2.

Does that help?

akirayamamoto avatar Oct 20 '22 23:10 akirayamamoto

Hi @finepointcgi

If I understand correctly, is this what you're asking?

  • Start with OLDFILE
  • Create a signature and then delta between OLDFILE and NEWFILE
  • OLDFILE becomes lost or corrupt
  • Given NEWFILE and the delta between OLDFILE and NEWFILE, can we recover OLDFILE?

The answer is, no, OLDFILE cannot be recovered here. The delta file contains information about what is different in NEWFILE, for example:

OLDFILE = "aaa123bbb" NEWFILE = "aaa999bbb"

The delta file will contain instructions as follows:

  • bytes 1-3 are unchanged
  • bytes 4-6 are "999"
  • bytes 7-9 are unchanged

Nowhere is there a record that in oldfile, bytes 4-6 were "123", that information cannot be recovered

borland avatar May 19 '23 04:05 borland