noble-hashes icon indicating copy to clipboard operation
noble-hashes copied to clipboard

Request for twox/xxhash

Open jacogr opened this issue 4 years ago • 2 comments
trafficstars

First off, this is impressive - I have early branches switching to this https://github.com/polkadot-js/common/pull/1188 (also planning on doing secp256k1 & ed25519 - the first also has a PR, the second haven't gotten around to). Anyway, in that bracnch a couple of operations actually beat out Rust WASM. So certainly impressive.

One of the reasons for switching to the @noble family (provided I can get the BigInt story right, have a number of React Native users) is the drops in dependencies, size and speed. Finally a library that follows recent ES standards without resorting to Buffer everywhere.

One of my hashing requests would be for xxhash, I'm currently using https://www.npmjs.com/package/xxhashjs and overall quite happy, but once again pulls in yet-another-big-numbers library. I'm guessing this is quite niche for the target audience, however xxhash is used extensively in the Polkadot/Substrate ecosystem in the runtime, so it would certainly be a welcome addition from this side of the fence.

jacogr avatar Nov 19 '21 09:11 jacogr

Thanks for the suggestion. Maybe someone will find it useful and implement it.

paulmillr avatar Nov 19 '21 14:11 paulmillr

I just adapted @jacogr's adaptation of xxhashjs for use in capi. I think this version could be adapted to work in this library quite easily – @paulmillr would you be open to such a contribution?

tjjfvi avatar Sep 03 '22 23:09 tjjfvi

I have decided to keep hashes small for now. Don't want to include xxhash. May reconsider this in the future.

Meanwhile, please use @tjjfvi stuff.

paulmillr avatar Dec 02 '22 06:12 paulmillr

In that case, if anyone is looking for an xxhash implementation, there's a TS implementation linked above as well as a tiny, 100x-faster WASM implementation that I wrote more recently.

tjjfvi avatar Dec 02 '22 20:12 tjjfvi