x-hash is a Javascript package that allows you to securely hash passwords with an optional salt and round value and use compare function to compare hashPassword and rawPassword
To install module simply run the following command in your console:
npm install x-hash
To use x-hash, first import it into your project:
const x-hash = require("x-hash");
or:
const { hashPass, compare } = require("x-hash");
-
you can see how we hash passwords using x-hash package like below:
const hashedPass = hashPass('password')
const hashedPass = hashPass('password', { salt = 20, rounds = 15 })
const hashedPass = hashPass('password', { salt = 10 })
-
if you want to compare passwords, here you are:
const isEqualPass = compare('password', hashedPass)
I will be grateful for any help you can provide to make this package better