title: Password(+salt) hashing and verifying in PHP and/or NodeJS
body: <p>I use in php the following code to generate a password hash and a salt.</p>
  
  <pre><code>$salt = password_hash(uniqid(openssl_random_pseudo_bytes(16), TRUE), PASSWORD_BCRYPT);
  password_hash($password . $salt, PASSWORD_BCRYPT);
  </code></pre>
  
  <p>I am using <code>bcrypt</code>in NodeJS and want to achieve to verify the password in NodeJS.
  I save the hash and the password salt in my database and can query this in my NodeJS application.</p>
  
  <p>After a few researching tries, I found this post on SO:
  <a href="https://stackoverflow.com/questions/23015043/verify-password-hash-in-nodejs-which-was-generated-in-php?answertab=votes#tab-top">Verify password hash in nodejs which was generated in php</a>
  Now I added the replace part to my code.</p>
  
  <p>My pseudo:</p>
  
  <pre><code>bcrypt.compare(password_from_input + salt_from_db.replace(/^\$2y(.+)$/i, '\$2a$1'), password_from_db.replace(/^\$2y(.+)$/i, '\$2a$1'), function(err, result) {
    console.log(result);
  });
  </code></pre>
  
  <p>And I also want it the other way around. So create a salt and hash in NodeJS and verify in PHP.</p>
  
  <p>I hope you guys can help me out.</p>