Skip to content

Switch from js-sha3 and blake to audited noble-hashes#547

Merged
OBrezhniev merged 6 commits intoiden3:masterfrom
paulmillr:noble-2
Apr 3, 2025
Merged

Switch from js-sha3 and blake to audited noble-hashes#547
OBrezhniev merged 6 commits intoiden3:masterfrom
paulmillr:noble-2

Conversation

@paulmillr
Copy link
Copy Markdown
Contributor

@paulmillr paulmillr commented Jan 20, 2025

noble cryptography (https://github.com/paulmillr/noble-hashes) is high-security, easily auditable set of contained cryptographic libraries and tools. It would be great to use it instead of some unknown library. Benefits:

  • Audited, less resources would be necessary for end-users to audit dep trail
  • Smaller bundle size
  • Is used by millions of users (see npm)
  • Since it's everywhere (e.g. in ethers.js), it would get de-duplicated by end-users when two packages depend on noble
  • Is actually maintained, has modern features like esm / typescript / bun / deno friendliness

All PRs:

Originally proposed 15 months ago in #416

@paulmillr paulmillr changed the title Switch sha3 and blake to audited noble-hashes Switch from js-sha3 and blake to audited noble-hashes Jan 20, 2025
Comment thread src/misc.js
@OBrezhniev
Copy link
Copy Markdown
Member

@Kolezhniuk can you please test this build on our multiplatform tests setup?

@Kolezhniuk
Copy link
Copy Markdown
Contributor

@Kolezhniuk can you please test this build on our multiplatform tests setup?

@OBrezhniev Tested, our js-sdk works fine with with this version of snarkjs. I don't think that this is critical because warning is for builds targeted on NodeJS
One, note that there are warnings during the build


> snarkjs@0.7.5 build
> npm run buildcjs && npm run buildcli && npm run buildiife && npm run buildiifemin && npm run buildesm


> snarkjs@0.7.5 buildcjs
> rollup -c config/rollup.cjs.config.js


main.js → build/main.cjs...
(!) Unresolved dependencies
https://rollupjs.org/guide/en/#warning-treating-module-as-external-dependency
@noble/hashes/blake2b (imported by src/powersoftau_new.js, src/powersoftau_export_challenge.js, src/powersoftau_import.js, src/powersoftau_verify.js, src/powersoftau_challenge_contribute.js, src/powersoftau_beacon.js, src/powersoftau_contribute.js, src/zkey_new.js, src/zkey_verify_frominit.js, src/zkey_contribute.js, src/zkey_beacon.js, src/zkey_bellman_contribute.js, src/powersoftau_utils.js, src/misc.js, src/keypair.js)
@noble/hashes/utils (imported by src/misc.js)
@noble/hashes/sha3 (imported by src/Keccak256Transcript.js)
created build/main.cjs in 265ms...

@OBrezhniev
Copy link
Copy Markdown
Member

@Kolezhniuk I've fixed rollup warnings and few other things. Can you review & recheck js-sdk tests?

@paulmillr
Copy link
Copy Markdown
Contributor Author

@OBrezhniev I see the pull requests have been merged; however this one and iden3/circomlib#119 still persist.

@OBrezhniev OBrezhniev merged commit 1de7c8a into iden3:master Apr 3, 2025
13 checks passed
@OBrezhniev
Copy link
Copy Markdown
Member

Hi @paulmillr! Yes, there was some WIP on my side there. Now both are merged. Thank you very much for contribution!

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

Successfully merging this pull request may close these issues.

3 participants