Closed mnpenner closed 8 years ago
It is just a wrapper for system crypt(3) function...
I guess it could in theory use another thread or process to call crypt() and implement async queue to use that thread somehow. (Other C++ threads do not block the JS iteration, so that would help if you're calling a lot crypt() and it's slow.) I have not seen any reason to implement that yet.
I'm using it to verify passwords via an ajax request in exchange for a JWT token. If I'm not mistaken, my Express server will only be able to handle one such request at a time if it's not async, and it takes ~250ms to hash a pass, so I suspect that could cause quite a bottle neck. It's not an issue right now, but I haven't stress tested it yet, just thought I would ask.
Yes, it might indeed.
I guess this kind of problem might be something which already has a wrapper implementation somewhere to make a synchronous C(++) function into JS async. I'm happy to implement it if it is an easy thing to do.
The official docs say that node uses libuv under the hood and you should be able to use it too make your functions async:
libuv: The C library that implements the Node.js event loop, its worker threads and all of the asynchronous behaviors of the platform. It also serves as a cross-platform abstraction library, giving easy, POSIX-like access across all major operating systems to many common system tasks, such as interacting with the filesystem, sockets, timers and system events. libuv also provides a pthreads-like threading abstraction that may be used to power more sophisticated asynchronous Addons that need to move beyond the standard event loop. Addon authors are encouraged to think about how to avoid blocking the event loop with I/O or other time-intensive tasks by off-loading work via libuv to non-blocking system operations, worker threads or a custom use of libuv's threads.
And here is a "simple" example and another one. I'm not really familiar with Node addons, but it doesn't look like too much code.
I'm happy to announce the version 1.0.0 with async support. Please test. :)
Awesome, thank you!!
Hi, thanks for making this lib. This is the only one I found that supports
$6$
.Is there any chance of getting an async version?