Skip to content

Commit

Permalink
updating readme with pr advice
Browse files Browse the repository at this point in the history
  • Loading branch information
RichardWright committed Aug 22, 2018
1 parent ce7c404 commit 2e86dd7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -213,7 +213,7 @@ In general, don't use the normal JavaScript string comparison functions to compa
cryptographic keys, or cryptographic hashes if they are relevant to security.

### Why is async mode recommended over sync mode?
If you are using bcrypt on a simple script, using the sync mode is perfectly fine. However, if you are using bcrypt on a server, the async mode is recommended. This is because the hashing done by bcrypt is CPU intensive, so the sync version will block the event loop and prevent your application from servicing any other inbound requests or events. The async version also uses another thread so as not to block the event loop.
If you are using bcrypt on a simple script, using the sync mode is perfectly fine. However, if you are using bcrypt on a server, the async mode is recommended. This is because the hashing done by bcrypt is CPU intensive, so the sync version will block the event loop and prevent your application from servicing any other inbound requests or events. The async version uses a thread pool which does not block the main event loop.

## API

Expand Down

0 comments on commit 2e86dd7

Please sign in to comment.