Here I use bcryptjs library to encrypt my password, Its works fine when i insert into db but its returns false every time to compare same password which i insert in DB. Here is my code.. Please tell me where i am wrong.
This code for inserting hash password in DB , It works perfect
     bcrypt.hash(insertData.Password, 10, function(err, hash) {
            // Store hash in your password DB.
            console.log('hash' , hash)
            insertData.Password = hash;
            insertIntoDB(table,insertData,function(result){
                if(result && result.length > 0){
                        res.json({
                            "status":"1",
                            "result":result[0]._id
                        });
                }
            });
     });
And Here is code for compare password but it always returns false.
var actualPass = results[0].Password //Store in DB password
bcrypt.hash(UserInputPassword, 10, function(err, hash) {
        console.log('hash' , hash)
        bcrypt.compare(actualPass, hash, function(err, response) {
            if(err){
                 console.log("err",err)
             }else{
                 console.log("response",response)                               
             }
        });
 });
    
compare()'ingactualPassagainst the hash from the database (e.g.insertData.Password) instead of a newly generated hash?