erha

command module
v0.0.0-...-4ee0c84 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 3, 2024 License: GPL-3.0 Imports: 1 Imported by: 0

README

ERHA - Eigner rolling hash algorithm

This rolling hash based file diffing algorithm will return when comparing original and an updated version of an input, it should return a description ("delta") which can be used to upgrade an original version of the file into the new file.

Test

$ make test

How to run ?

Build the binary
$ make build 
ERHA file diff algorithm
// Note: It will not write the signature and delta of files into output files.
// For this, please use subcommands of erha.
$ go run main.go original-file signature-output-fule --chunk_size CHUNK_SIZE 
Example:
$ go run main.go 1.txt 2.txt --chunk_size 4
>  [ 0 - 4 ]  sai 
>  [ 4 - 8 ]  kuma
-  [ 5 - 9 ]  ruma
+  [ 8 - 21 ]  r and new one
Generate signature
$ go run main.go signature original-file signature-output-fule --chunk_size CHUNK_SIZE 
// default CHUNK_SIZE is 2 
Example:
$ go run main.go signature 1.txt sig.txt --chunk_size 2
// or 
$ ./build/erha signature 1.txt sig.txt --chunk_size 2
// output
$ go run main.go signature 1.txt sig.txt --chunk_size 4      
INFO[2024-03-03T16:59:03+05:30] Signature is written to sig.txt
Delta of the original and new file
$ go run main.go delta signature-file new-file deleta-output-file --chunk_size CHUNK_SIZE 
$ go run main.go delta sig.txt 2.txt delta.txt
// or 
$ ./build/erha delta sig.txt 2.txt delta.txt

// Output 
$ go run main.go delta sig.txt 2.txt delta.txt --chunk_size 4
>  [ 0 - 4 ]  sai 
>  [ 4 - 8 ]  kuma
-  [ 5 - 9 ]  ruma
+  [ 8 - 21 ]  r and new one
INFO[2024-03-03T16:58:38+05:30] files delta is written to delta file :delta.txt

Documentation

Overview

Copyright © 2024 Sai Kumar <gskumar967@gmail.com>

Directories

Path Synopsis
FileSystem operations
FileSystem operations

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL