Cheers Matt,

I expected it to be faster because its speed is talked about on the GH page:

https://github.com/fpirsch/twin-bcrypt

I'm just coming into the Node world and didn't know about asm.js not being
supported in V8.

I asked the author of that repo directly and he filled me in on what you
mentioned:

https://github.com/fpirsch/twin-bcrypt/issues/1

Of course being slow is a good thing with BCrypt, but given two modules
that do the same thing, you want to be running the fastest one, surely?

A

On 11 September 2014 14:19, Matt <[email protected]> wrote:

> Two issues: 1) Why would you expect it to be faster? It's pure JS using
> asm.js (which Node doesn't support), vs bcrypt is compiled C code. And 2)
> Being slow is a feature of bcrypt - it makes brute force cracking harder.
>
> On Wed, Sep 10, 2014 at 10:54 AM, Adrian Lynch <
> [email protected]> wrote:
>
>> I'm seeing bcryptjs beat twin every time with the following code:
>>
>> var bcryptJS = require('bcryptjs');
>> var twinBcrypt = require('twin-bcrypt');
>>
>> var password = "password";
>> var rounds = 12;
>> var hash, start, end;
>>
>> // twin-bcrypt
>> start = new Date();
>> hash = twinBcrypt.hashSync(password, twinBcrypt.genSalt(rounds));
>> end = new Date();
>> console.log("Took \t" + (end - start) + "ms\t to hash '" + password + "'
>> into '" + hash + "'");
>>
>> // bcryptjs
>> start = new Date();
>> hash = bcryptJS.hashSync(password, bcryptJS.genSaltSync(rounds));
>> end = new Date();
>> console.log("Took \t" + (end - start) + "ms\t to hash '" + password + "'
>> into '" + hash + "'");
>>
>> On my Mac, BJS comes in at ~950ms and twim, ~1700ms.
>>
>> From the description of twin-bcrypt, I'd expect it to be quicker.
>>
>> Does my test code look OK? Am I mis-using the libs?
>>
>> Thanks.
>>
>> Adrian
>>
>> --
>> Job board: http://jobs.nodejs.org/
>> New group rules:
>> https://gist.github.com/othiym23/9886289#file-moderation-policy-md
>> Old group rules:
>> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "nodejs" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/nodejs/CAH368SSHMxGhSWepY5bOETSdkW8uY76b%3D8FFm6Tk6yt2aKWVRQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/nodejs/CAH368SSHMxGhSWepY5bOETSdkW8uY76b%3D8FFm6Tk6yt2aKWVRQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> Job board: http://jobs.nodejs.org/
> New group rules:
> https://gist.github.com/othiym23/9886289#file-moderation-policy-md
> Old group rules:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> ---
> You received this message because you are subscribed to the Google Groups
> "nodejs" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/nodejs/CAPJ5V2ZnpqBYb%3DgNU2pCeo1BnBiG2r5kx6sBVbb5kRZw3FSF0A%40mail.gmail.com
> <https://groups.google.com/d/msgid/nodejs/CAPJ5V2ZnpqBYb%3DgNU2pCeo1BnBiG2r5kx6sBVbb5kRZw3FSF0A%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/CAH368SQZf1_oMSTo6Kf_K%2BVBw0%3DN%3DF4yfQHziZ-VBnwpHgNh8w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to