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
Replace jsbn.js #24
Comments
@arasmussen hey Andrew, This repo is no longer maintained, a group of javascript bitcoin developers have come together and forked this so that we can maintain it. It is split into many modules and you can find them here. |
As of today, there is a building maintenance team for this repository so we can keep it in sync with bugfixes and changes from the community. It might be impossible to improve the performance here, but keep in mind that JavaScript is pretty slow at cryptography in general. We don't get any assist from the browser, so this stuff is all implemented in pure JS at the moment. I won't have time to improve this. Pull requests here are certainly welcome, but I wouldn't expect miracles here. You might be able to shave off 5-15%, but I would be surprised if someone could really speed this up. That said, I doubt the code's been optimized that heavily. |
One approach could be to implement some of this in Node.js, and then keep the pure JS version for the browser. If that works for you, you might want to take a look at Bitcore, which I believe has already done this. |
Surely the performance problems must be from the use of jsbn? How about https://github.com/justmoon/node-bignum? |
Interesting thought. If we were going to replace jsbn, my early candidate would be https://github.com/MikeMcl/bignumber.js Also, he uses Bitcoin! |
Ah, I see what you mean now. That would be a good solution to drop in for node.js usage, falling back to jsbn or something better. My thought was bignumber.js or something similar might be faster than jsbn so it could potentially be considered if it supports the right functionality. |
big.js and bignumber.js look really nice. an advantage of the one i linked is that it has C bindings. |
You're right! He accepts bitcoin donations. We've certainly gone mainstream. |
We also have the same problem over at http://github.com/cryptocoinjs. We're currently using
With this, you give up browser support. |
We should support browser and node.js. If we did have a node-specific option, we would need to provide a browser alternative as well. @jprichardson if you come up with a solution here that works in the browser and is faster let us know, we will happily make sure it gets into the code base! |
Some other library suggestions and a whitepaper courtesy (thanks to Charles Hoskinson for the research!): |
http://jsperf.com/bignumber-js-vs-big-js-vs-jsbn jsbn still seems like the fastest on most browsers. If someone can wrap https://github.com/justmoon/node-bignum into the same interface as jsbn we can use the wrapped version for node. There will be a speed gain for server side for sure. |
Hi everyone, I have a question ? I am using bitcoinJS library and I want to create less compressed pub key via private key ? |
This last line takes about 20 milliseconds on my computer, which is a bottleneck for the product I'm developing. Would love to see if we can make it faster.
The text was updated successfully, but these errors were encountered: