title: nodejs - bcrypt: compare hash with password always return not match
body: <p>i'm trying to use the npm package 'bcrypt' for insert crypted password during signup on my PSQL db and login a user.</p>
  
  <p>The operations that i do:</p>
  
  <p>1) Signup: Insert username and crypted password on my PostgreSQL db</p>
  
  <pre><code>createUser: function(username, password) {
          bcrypt.genSalt(saltCount, function(err, salt) {
              bcrypt.hash(password, salt, function(err, hash) {
                  query = "insert query with generated crypt password";
                  pool.query(query, (err, res) =&gt; {
                      console.log(err, res);
                  })
              });
          });
      }
  </code></pre>
  
  <p>2) Login user: get inserted password and compare with crypted password on PostgreSQL db</p>
  
  <pre><code>login: function(username, password) {
          const query = "select query for get crypt passowrd on db";
          pool.query(query, (err, res) =&gt; {
              const dbPsw = res.rows[0].hash_psw; // db password
              bcrypt.compare(password, dbPsw, function(err, result) {
                  if (err)
                      console.log(err);
                  else if (result)
                      console.log("password match");
                  else
                      console.log("not match");
              });
          })
      }
  </code></pre>
  
  <p>The result of second function is always "not match".</p>
  
  <p>I saw on my PSQL db that the inserted password by the first function is always different event i always insert the same password to be crypted.</p>
  
  <p>So my question is: How can i get always the same crypted password?
  I'm probably doing something wrong but i follow the guide on npm site.</p>
  
  <p>Thanks for your help.</p>