Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ideas for next major update #88

Open
paulmillr opened this issue May 15, 2024 · 8 comments
Open

Ideas for next major update #88

paulmillr opened this issue May 15, 2024 · 8 comments

Comments

@paulmillr
Copy link
Owner

paulmillr commented May 15, 2024

  • Remove cryptoNode import! Requires to ditch support for nodejs v18 (EOL 30 Apr 2025)
  • Remove import maps. Change @noble/hashes/sha3 to @noble/hashes/sha3.js
    • Import maps are not browser-friendly etc
    • Before doing this, actually test in real browser
  • Test in different environments:
    • bundler-less browser
    • deno
    • bun
  • See how package can fit for JSR.io
  • Rename / refactor
    • crypto / cryptoNode => webcrypto (to match noble-ciphers)
    • sha256, sha512 => sha2? not sure yet
    • blake2b, blake2s, blake3 => blake?
    • ripemd160 => ripemd?
    • sha1 => legacy? and add md5??

Maybe also:

  • Make package ESM-only
  • Re-audit (need $ funds)
@imcotton
Copy link

imcotton commented Jun 5, 2024

Any thoughts on adding non-cryptographic hashes? e.g.:

  • CRC32
  • Murmur3
  • xxHash
  • City
  • etc...

@paulmillr
Copy link
Owner Author

What would be the use case?

@imcotton
Copy link

imcotton commented Jun 5, 2024

In general non-cryptographic hashes give synchronize call which widely applicable.

CRC32 is good for quick integrity check.

Both Murmur3 and xxHash commonly used in Bloom Filter, however existing widely used NPM packages all using old syntax (ES5, CJS) and have no updates in 5-6 years.

In case of Murmur3, rarely handle utf8 correctly1. Jumping rabbit hole forks lead to inactive non-resolved issue2

Footnotes

  1. https://github.com/cimi/murmurhash3js-revisited

  2. https://github.com/karanlyons/murmurHash3.js/issues/13

@wasd171
Copy link

wasd171 commented Aug 5, 2024

Would be great to have a properly supported murmur3 hash for Kafka-like projects!

@imcotton
Copy link

imcotton commented Aug 5, 2024

Btw, I'm currently settle on fnv1a as alternative to Murmur3, changeable via:

  • npm:@sindresorhus/fnv1a
  • jsr:@std/crypto crypto.subtle.digestSync('FNV32A')

@paulmillr
Copy link
Owner Author

paulmillr commented Sep 9, 2024

Quote from contributor about ESM transition:


Got it, thank you for explaining the rationale! Might be worth considering that extended support for Node.js v18 will be provided for users of among others:

So for these users, Node.js v18 will not actually be deprecated during 2025 and some users will expect to keep using their supported runtime versions beyond the upstream maintenance window.

Not meaning to imply that ethereum-cryptography should match all of these (or even strictly needs to consider any of it, though it would be nice1), just that "when nodejs v18 is deprecated" is not an entirely black-and-white question and hopefully bring some nuance to the ESM-only timeline consideration.

Footnotes

  1. If it were me, I think it could be a good target to aim at having if not mainline then at least critical and security-related bugfixes backported to a major version runtime compatible during lifetime of Debian bookworm (2028-06) if not also Standard Support for Ubuntu 24.04 LTS (2029-04). Or if not that, at least until both distros have new stable/LTS versions providing newer Node.js versions (~2026?). This is considering users who are comfortable using the vendor-provided versions but where either nvm, or "compile it from source" are non-starters (for compliance reasons or otherwise). And if we're doing that, I imagine that maintaining two separate build systems will not be worth the headache....

@mahnunchik
Copy link
Contributor

+1 to add md5 😉

@paulmillr
Copy link
Owner Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants