Someone asked about a JavaScript implementation of bCrypt a while back and appears to have written their own code to handle the implementation. Does anyone have an implementation of sCrypt in JavaScript?
-
i can't even find any C implementations .. http://news.ycombinator.com/item?id=2004962 use that bcrypt.. at your own risk .. – c69 Oct 01 '11 at 01:01
-
It's not that I prefer scrypt to bcrypt it's that I'm interfacing with an existing project which already uses scrypt. I'd use bcrypt if it were my choice, but it's not :P – David Perry Oct 01 '11 at 02:52
-
well, _if you have access to code_ :] - start porting it :D – c69 Oct 01 '11 at 03:11
-
3Well it's FOSS but it's also a distributed project so unless I get 51% or more of the entire network of users to switch to my ported code my port won't be worth much... – David Perry Oct 01 '11 at 07:56
7 Answers
The answer linked above points to a project that no longer exists.
This project, however, is still around: https://github.com/tonyg/js-scrypt
If you are talking about tenebrix, the choice of scrypt was better then bcrypt for the goals set. I so far have only found one incomplete javascript implementation of scrypt and hit on this page while searching.
https://github.com/byrongibson/scrypt-js https://github.com/cheongwy/node-scrypt-js was all I found so far, and seems no code yet.
Guess as a new reason I can't just comment on this above like I wanted, sigh.
-
I am in fact talking about Tenebrix. I was considering building a JavaScript miner but I'm not nearly good enough in JavaScript to implement any kind of encryption from scratch. – David Perry Oct 02 '11 at 22:19
-
I guess this is as good as it's likely to get. I'll keep an eye on this project and see if it ever comes to fruition. Thanks! – David Perry Oct 04 '11 at 22:20
https://github.com/tonyg/js-scrypt is an emscripten-compiled version of Colin Percival's scrypt() function.

- 905
- 7
- 9
Here are the two I can find:
I've tried only barrysteyn's node-scrypt, and its excellent. He recently put a lot of effort into making the library conform to javascript conventions, and the API is great.

- 57,525
- 34
- 189
- 207
I'll toss my implementation into the ring: https://github.com/cryptocoinjs/scryptsy. It is based upon https://github.com/cheongwy/node-scrypt-js, but has been cleaned up and tested in both Node.js and the browser.

- 38,609
- 36
- 119
- 151
Tony's works great in chrome, chrome's js executes cost of 16384 faster than CryptSharp's SCrypt does. Around 200ms for chrome and 450ms for CryptSharp.
Trouble is that IE takes upwards of 24 seconds and FF upwards of 16 seconds.
Unfortunately, not all browsers are created equal..

- 780
- 6
- 14
-
Andrew, I am curious: is that benchmark for CryptSharp 1.2 or 2.0? Thanks. – James Dec 18 '13 at 21:20
-
CryptSharp (Official Version) on NuGet, Id:CryptSharpOfficial Version:2.0 Published:5/8/2013 – Andrew Hoffman Dec 18 '13 at 21:23
-
Hmm. I wonder what more I could do to optimize it. The core loop's already unrolled. Surprising that a JavaScript implementation could be so much faster. – James Dec 18 '13 at 21:26
-
Keep in mind that chrome's js engine is amazing and is what node.js is based off of. Its not your average js engine. http://en.wikipedia.org/wiki/V8_(JavaScript_engine) Ok so V8 compiles javascript to machine code before executing it, thats why. – Andrew Hoffman Dec 18 '13 at 21:39
-
And then it optimizes your code with "inlining, elision, inline caching" and other wizardry techniques. Basically they take your js and make it betterer. – Andrew Hoffman Dec 18 '13 at 21:48
-
http://stackoverflow.com/questions/15393039/why-v8-in-node-js-is-faster-than-in-my-native-c-addon So Don't feel bad @Zer it seems to be a common thing. – Andrew Hoffman Dec 18 '13 at 21:59