node.js - How can i check a PHP MD5 hash with number type in nodejs server
one text
Solution:
The md5 function in PHP calculates the hash of a string, so in your example it's actually calculating the hash of "10".
To do this in Node.js should be quite simple:
const dataToHash = Buffer.from(String(10), "utf-8");
const hash = crypto.createHash("md5").update(dataToHash).digest("hex");
console.log("Hash:", hash);
We get the same result in Node.js as in PHP, e.g.
Hash: d3d9446802a44259755d38e6d163e820
Source