-
Notifications
You must be signed in to change notification settings - Fork 517
bcrypt vs bcrypt.js
bcrypt.js is a pure js implementation version of bcrypt hashing algorithm. It has a similar interface to bcrypt and in most casehjs used as a drop-in replacement.
Since v2.x of bcrypt, the versions are not entirely compatible. We have an additional parameter to force the generation of 2a
or 2b
hashes.
While bcrypt.js has the same API surface on the JS side; it does not actually implement background work in the same way as the c++ bindings. The c++ bindings use a background thread pool while bcrypt.js will block your main thread pool.
This may have implications for your services so make sure you understand what you are doing and how it will impact your services before switching dependencies.
On an average, c++ bcrypt will be 30% faster than the plain js implementation.
If you are having a small scale project, then bcrypt.js will easily suffice for you. Also, c++ bcrypt will not work in browser environments, the only choice there is bcrypt.js.