Secure-Hash is a Node.js package for securely hashing and verifying passwords.
To install the package, run the following command:
npm install secure-password-hash
Require the secure-hash package in your code to access its functionality:
const { hashPassword, verifyPassword } = require("secure-hash");
To hash passwords, use the hashPassword function provided by the package. Here's an example:
const password = "userPassword";
const hashedPassword = hashPassword(password);
console.log("Hashed password:", hashedPassword);
To verify passwords, use the verifyPassword function provided by the package. Here's an example:
const password = "userPassword";
const isMatch = verifyPassword(
password,
hashedPassword.hash,
hashedPassword.salt
);
console.log("Password match:", isMatch);