Comments (4)
Worth noting the new lib was funded by EF https://blog.ethereum.org/2022/06/01/may-22-grantee-roundup
from solc-js.
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.
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.
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)
- Downloading binaries from `emscripten-asmjs/` and `emscripten-wasm/` dirs in solc-bin
- Exception in an import callback leaves the compiler in an inconsistent state, leading to `You shall not have another CompilerStack aside me` error on next compilation HOT 13
- Does solc.loadRemoteVersion() download a new version of solc each time it is run? HOT 2
- Different bytecode when compiling from both solc-js and remix IDE
- cannot uninstall HOT 2
- OSError: [Errno 86] Bad CPU type in executable: HOT 1
- Cannot remap openzeppelin to use when I compile with solc HOT 1
- Release types on npm HOT 3
- Handle standard JSON transalation with `outputSelection` for `=<0.4.19`
- Failed to compile large json inputs HOT 1
- Callback not supported... HOT 2
- Identifier already declared HOT 2
- solc-select is out of date. Please run `solc-select upgrade` HOT 1
- Support for `--metadata` flag HOT 4
- 0.8.23 npm release won't install on Windows due to a stray dependency HOT 3
- findImports fallback on webWorkers not working HOT 5
- loadRemoteVersion is not working with jest test HOT 3
- 'Expected Pragma' error in solc but same code compiles in remix HOT 1
- Improvement: `content` not a key in solidity `input description` in solidity official doc (except under `destructible`) .
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from solc-js.