-
Notifications
You must be signed in to change notification settings - Fork 570
Slow crypto operations (WebCryptoAPI support) #554
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
A lot of work has already been done by @kothar here: https://bitbucket.org/kevalin-p2p/subtlecrypto |
I had similar thoughts - my initial plan was to create an isomorphic library that could fall back to the stdlib implementation if it couldn't find a browser implementation (or was running natively), but that doesn't help any of the other standard library code which uses crypto. Specifically net/http2 for what I was working on, although I feel like that's a bizarre use case anyway. |
A general method for fallbacks like that would probably be useful in many areas, not just crypto. |
I guess one way to do it would be to rename the original overridden function e.g. by adding a suffix, allowing it to be called from the overriding function. |
I was considering that too. For example, by always adding a prefix such as My main concern about that was the following. Currently, replaced identifiers get replaced with blank identifiers If we change all |
It'll be very useful for OFACrypto. |
Uh oh!
There was an error while loading. Please reload this page.
Crypto operations are really slow with gopherjs.
Here is a small benchmark, consisting of hashing a 10MB buffer through SHA-256: http://www.gopherjs.org/playground/#/X98vxh8Y97
Depending on the type of operation, the difference can be even bigger. Issue #526 mentions 300x slower operations for RSA signatures.
I think it would be really great if crypto operations were implemented by calling the WebCryptoAPI.
As an exemple, here is a simple POC, with the same operation implemented with WebCrypto: http://www.gopherjs.org/playground/#/-_Ed7QocdZ
The execution times are:
That's about 25x as fast as the current version, and even twice as fast as a native go program!
The text was updated successfully, but these errors were encountered: