Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

How i can create hash password and match password for different users #466

Answered by Sokhavuth
amir7896 asked this question in Help
Discussion options

You must be logged in to vote

You could use bcrypt that is independent from any kind of database. Here is an example of using bcrypt in Node.js:

// npm install bcryptjs
const bcrypt = require("bcryptjs")

// to hash a password
const hashedPassword = bcrypt.hashSync("password", 8)
const bcrypt = require("bcryptjs")

// to verify password
if(bcrypt.compareSync(req.body.password, user.hashedPassword)){
    ...
}else{
    ...   
}

Here is my website on Deta in which bcrypt is being used to hash and verify password: https://khmerweb.deta.dev/

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
1 reply
@amir7896
Comment options

Comment options

You must be logged in to vote
3 replies
@amir7896
Comment options

@Sokhavuth
Comment options

@amir7896
Comment options

Answer selected by amir7896
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
3 participants