paulmillr / noble-hashes

Audited & minimal JS implementation of hash functions, MACs and KDFs.
https://paulmillr.com/noble
MIT License
573 stars 46 forks source link

Request for twox/xxhash #10

Closed jacogr closed 1 year ago

jacogr commented 2 years ago

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.

paulmillr commented 2 years ago

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

tjjfvi commented 2 years ago

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?

paulmillr commented 1 year ago

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.

tjjfvi commented 1 year ago

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.