node.js - Compare Nodejs generated bcrypt hash in PHP


Just to know about bcrypt hash comparison in different platforms, that I have one brypt hash which is generated at Nodejs server, now I am moving to PHP, I want to know about is this possible to compare already created bcrypt hashes(generated in Nodejs) in PHP

Node JS Code:

function hash(password) {
  return new Promise(function(fulfill, reject) {
    bcrypt.hash(password, 8, function(err, hashedPassword) {
      if (err) {
      } else {

Input :simha


Is it possible to generate the ouput hash using inputsimha in PHP

I am trying the below one, but it is generating different hash

password_hash($password, PASSWORD_BCRYPT) 
//output : $2y$10$CfihL9RipXW88JAVvlyFlegM5BAyD5xQmNutjm9KepeXUn5cAwIX2



You shouldn't expect them to match, at least by default. This is because for both functions, a random salt is chosen every time you hash a value.

The important thing is not that the hash outputs match, but that they still validate. So you could take the hashed output from node.js and use it with in PHP for example, and it should validate.

People are also looking for solutions to the problem: wordpress - How to charge card on clicking accept button in stripe in PHP


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.