Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reversible string diff (history) algorithms for C#?

Here's an interesting question that I don't know much about in terms of existing solutions or research in the field, though I would imagine it relates to the field of compression.

Given two potentially large strings of text, where one represents a later version of the former, is it possible (well I know it's possible, I'm asking really are there existing solutions) to compare those two strings and reduce them to a set of differences that could then later be used to deterministically reconstruct the original strings?

In my case, I'm interested in storing the latest version of the string, but keeping "compressed" (diffed) historical backups that can be restored as needed, without actually having to store all of the duplicated information.

I don't know what to tag this, please help me out.

like image 801
devios1 Avatar asked Oct 12 '22 15:10

devios1


1 Answers

There is no built in classes in CLR that support diffing.

Related questions seem to have have useful information (i.e. Creating Delta Diff Patches of large Binary Files in C#). You can also look search on "Delta encoding" to start with (i.e. http://en.wikipedia.org/wiki/Delta_encoding).

like image 126
Alexei Levenkov Avatar answered Nov 03 '22 20:11

Alexei Levenkov