Use Native Argon2 on Desktop #4786
Replies: 2 comments 5 replies
-
Just tested on node v18.12.1, the non-SIMD version of argon2-browser vs native argon2 for Bitwardens max Settings (iterations=10, memory=1GiB, threads=16), and the times on my system are: 1.6 seconds on native, vs 23 seconds on WebAssembly. With the SIMD version it is ~14 seconds, so using the native version where possible would be much better. |
Beta Was this translation helpful? Give feedback.
-
Hi @quexten, thanks for these write ups and all your work on improving our KDFs. I agree with you that web asssembly and mobile should be the leaders in performance improvements -- those are not only the most popular clients, but also the ones suffering from weakest hardware/runtimes. I feel we'll likely want to make improvements in the desktop space eventually, but we can worry about that when we're in a place that Desktop is more likely to be the kdf pain point vs browser and mobile. |
Beta Was this translation helpful? Give feedback.
-
As issue #4779 points out, parallelism does not work on desktop. Furthermore it is quite slow compared to mobile and cli. This is because it uses the webcryptofunctionservice which uses WebAssembly.
My proposal would be to create a new "electronCryptoFunctionService" extending the webcryptofunctionservice. For argon2 it would talk to the main process via IPC and call a native argon2 implementation (maybe even just a nodecryptofunctionservice instance).
The benefit would be up to 90% reduction in unlock time (going by argon2-browser's benchmarks in the readme) and working parallelism.
Beta Was this translation helpful? Give feedback.
All reactions