To salt and hash password in Node with crypto, we call the hashSync method.
For instance, we write
const bcrypt = require("bcrypt");
const salt = bcrypt.genSaltSync(10);
const hash = bcrypt.hashSync("B4c0//", salt);
to create a salt with genSaltSync.
Then we call hashSync with the string to create a hash for and the salt to create the hash.
We then compare the hash with
const isSame = bcrypt.compareSync("B4c0//", hash);
by calling compareSync with the unhashed string with the hash.