Update hash-and-compare-passwords-synchronously.english.md (#38226)

This commit is contained in:
Prakash Kumar
2020-02-18 13:58:38 +05:30
committed by GitHub
parent bb06330b63
commit c730f4aef4

View File

@ -14,7 +14,7 @@ Hashing synchronously is just as easy to do but can cause lag if using it server
var hash = bcrypt.hashSync(myPlaintextPassword, saltRounds); var hash = bcrypt.hashSync(myPlaintextPassword, saltRounds);
``` ```
Add this method of hashing to your code and then log the result to the console. Again, the variables used are already defined in the server so you wont need to adjust them. You may notice even though you are hashing the same password as in the async function, the result in the console is different- this is due to the salt being randomly generated each time as seen by the first 22 characters in the third string of the hash. Add this method of hashing to your code and then log the result to the console. Again, the variables used are already defined in the server so you won't need to adjust them. You may notice even though you are hashing the same password as in the async function, the result in the console is different- this is due to the salt being randomly generated each time as seen by the first 22 characters in the third string of the hash.
Now to compare a password input with the new sync hash, you would use the compareSync method: Now to compare a password input with the new sync hash, you would use the compareSync method:
```js ```js