Giter Club home page Giter Club logo

Comments (4)

paulmillr avatar paulmillr commented on June 2, 2024 1

Worth noting the new lib was funded by EF https://blog.ethereum.org/2022/06/01/may-22-grantee-roundup

from solc-js.

cameel avatar cameel commented on June 2, 2024

Sounds reasonable. We should consider it.

js-sha3 did not have new releases since 2018. I guess something like that does not have to be updated constantly and it has no dependencies to keep up with so it might still be fine but even then I'd expect something to happen in the repo in the last 4 years.

@r0qs can you take a look at the new library when you have a moment?

from solc-js.

r0qs avatar r0qs commented on June 2, 2024

Hi @paulmillr, thanks for bringing this up. Indeed it would be great to replace js-sha3 with a faster and more actively maintained library, although I agree that this kind of library does not require too much updates, as @cameel pointed out.

However, your implementation does not seem to be faster than js-sha3 as the PR title suggest. I ran your benchmarks and the results show that js-sha3 outperforms noble hashes:

==== SHA3-256, keccak256, shake256 ====
SHA3-256, keccak256, shake256 32B node x 309,310 ops/sec @ 3μs/op ± 14.98% (min: 1μs, max: 40ms)
SHA3-256, keccak256, shake256 32B hash-wasm x 447,828 ops/sec @ 2μs/op ± 1.84% (min: 1μs, max: 2ms)
SHA3-256, keccak256, shake256 32B stablelib x 173,671 ops/sec @ 5μs/op
SHA3-256, keccak256, shake256 32B js-sha3 x 217,770 ops/sec @ 4μs/op ± 1.09% (min: 3μs, max: 4ms)
SHA3-256, keccak256, shake256 32B sha3 x 57,398 ops/sec @ 17μs/op
SHA3-256, keccak256, shake256 32B noble x 87,642 ops/sec @ 11μs/op

SHA3-256, keccak256, shake256 64B node x 254,647 ops/sec @ 3μs/op ± 25.04% (min: 1μs, max: 47ms)
SHA3-256, keccak256, shake256 64B hash-wasm x 438,212 ops/sec @ 2μs/op ± 2.91% (min: 1μs, max: 1ms)
SHA3-256, keccak256, shake256 64B stablelib x 192,566 ops/sec @ 5μs/op ± 7.57% (min: 3μs, max: 37ms)
SHA3-256, keccak256, shake256 64B js-sha3 x 244,319 ops/sec @ 4μs/op ± 1.49% (min: 3μs, max: 1ms)
SHA3-256, keccak256, shake256 64B sha3 x 64,520 ops/sec @ 15μs/op
SHA3-256, keccak256, shake256 64B noble x 97,551 ops/sec @ 10μs/op

I haven't looked at the audits report yet, but I will do it shortly. Were all the audit findings already addressed in your implementation?

from solc-js.

paulmillr avatar paulmillr commented on June 2, 2024

js-sha3 outperforms noble hashes

Right - I forgot about this. This is because the loops are not unrolled for auditability. You should decide whether the performance degradation is acceptable to your use case. It's acceptable for wallets etc.

Were all the audit findings already addressed in your implementation?

1) The audit was 11 months ago 2) there were no vulnerabilities in noble-hashes, vulns were in other libraries 3) every small "non-vulnerability" item was addressed immediately after it was posted

from solc-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.