hashSync
hashSync is a synchronous password hashing function provided by the bcrypt library for Node.js applications. It generates a cryptographically secure hash from a plain text password string by automatically producing a salt and combining it with the password using the Blowfish cipher-based hashing algorithm. The function accepts two parameters: the password to hash and a salt rounds value that determines the computational cost of generating the hash. Higher salt rounds increase security by slowing down brute-force attacks but require more processing time; 10-12 rounds are generally recommended for modern systems.
Unlike its asynchronous counterpart hash, hashSync blocks the event loop until the hashing operation completes, making
Security best practices recommend never storing plain text passwords and always using a unique salt per password,