zellular-xyz / zsequencer

PoC implementation of the Zellular sequencing protocol
https://zellular.xyz
3 stars 0 forks source link

Use a fast standard hash function instead of xxhash #51

Closed abramsymons closed 3 weeks ago

abramsymons commented 3 weeks ago

xxhash is used instead of hashlib hash functions to improve performance. The signatures generated by zsequencer should be verified using different apps and it makes sense to use standard sha3 or sha256 instead of xxhash. We should evaluate the performance of xxhash and compare it with builtin hashlib hash algorithms implementations like sha3 and sha256 and use a standard alternative.

mchitgarha78 commented 3 weeks ago

I ran a benchmark to compare xxhash with standard hashing algorithms from hashlib. The results show that xxhash is much faster:

data = b"some large data to hash" * 1000000

Benchmark Results:
xxhash: 0.001875 seconds
MD5: 0.027781 seconds (xxhash is 14.82x faster)
SHA-1: 0.010699 seconds (xxhash is 5.71x faster)
SHA-256: 0.011921 seconds (xxhash is 6.36x faster)
SHA-512: 0.027182 seconds (xxhash is 14.50x faster)
BLAKE2b: 0.026005 seconds (xxhash is 13.87x faster)