The Diff Match and Patch libraries offer robust algorithms to perform the operations required for synchronizing plain text.
BSD-3 license (https://opensource.org/licenses/BSD-3-Clause)