Answers for "bcrypt compare return false"

1

bcrypt compare return false

/*
  you can skip doing bcrypt.genSalt and use 
  bcrypt.hash(password, 10, function(err, hash) {..});
  this is working fine for me:
*/

var bcrypt = require('bcrypt');

bcrypt.hash('mypassword', 10, function(err, hash) {
    if (err) { throw (err); }

    bcrypt.compare('mypassword', hash, function(err, result) {
        if (err) { throw (err); }
        console.log(result);
    });
});
Posted by: Guest on April-16-2021
2

bcrypt compare

import bcrypt from 'bcryptjs'

export const matchPassword = async (enteredpassword, oldPassword) => {
  return await bcrypt.compare(enteredpassword, oldPassword)
}
Posted by: Guest on April-12-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language