MiloszKrajewski / K4os.Compression.LZ4

LZ4/LH4HC compression for .NET Standard 1.6/2.0 (formerly known as lz4net)
MIT License
681 stars 78 forks source link

Interface for hash functions #12

Open Krakean opened 5 years ago

Krakean commented 5 years ago

@MiloszKrajewski Hello. Can you provide here:

var HC = (byte) (XXH32.DigestOf(_buffer16, 0, _index16) >> 8);

and here:

var actualHC = (byte) (Farmhash.Sharp.Farmhash.Hash32(_buffer16, _index16) >> 8);

Ability to use other hash function via some kind of interface, or something like this? For those, who want to use something else than xxhash. Specifically I would like to use Farmhash here which is faster than xxhash (depends on payload, though).

MiloszKrajewski commented 5 years ago

Please note that this hash is header hash: it is maximum 16 bytes, but 6 bytes most of the time. I guess virtual (interface/Func<>) call takes more time than calculating this hash.

If you thinking about block/content hash it is not implemented yet at all (not written/ignored on read) but I'll think about making them pluggable somehow.

Krakean commented 5 years ago

@MiloszKrajewski no progress on this? :-\