Replies: 3 comments
-
ethers/keccak uses js-sha3. I'll reply with numbers in a bit, but the important thing you need to understand is that the libraries serve different purposes. noble's purpose is extreme auditability, small size. We have tests that no one else does (see tests/readme), test for DoS resilience etc. Noble is also in process of getting a security audit by an independent firm. noble implements sha3/keccak in slightly more than 160 lines. js-sha3 implements it in 600 lines. js-sha3 essentially unwraps loops and writes each step manually. Which is hard to verify. But could be faster. Even if js-sha3 is 2x faster, it's not like it matters. 180,000 hashings per second is still pretty good! If you want to verify/generate eth transactions, the slowest part would be verifying secp256k1 signatures, not hashing. I mean like 50x slower. |
Beta Was this translation helpful? Give feedback.
-
If you want to do smooth 120FPS rendering, you have 8.3ms per frame, which means you can do 22,107 hashes per 8.3ms. You can do 2,000 hashes and still have 7.5ms for everything else. |
Beta Was this translation helpful? Give feedback.
-
This is awesome - thanks for the detailed answer(s). For context, I'm relying on a JS implementation of Keccak in my prb-proxy project. Currently I'm using ethers but this is a convincing argument in favor of noble, I might just make the switch. |
Beta Was this translation helpful? Give feedback.
-
Pardon me for opening an issue for a simple question (may be worth it to enable discussions on this repo?)
Is this implementation of SHA3/ Keccak faster than @ethersproject/keccak256?
Side note: I might do the comparison later myself, but feel free to beat me to it if you know the answer already:)
Beta Was this translation helpful? Give feedback.
All reactions