I'm trying to generate a MD5 hash code in NodeJS and compare it with a php-generated MD5 hash code with number type ex: md5(10)
.
NodeJS does not seem to have a way to generate a MD5 hash with number type only - only String, Buffer, Array or Uint8Array types are supported.
I tried storing the number into a buffer, or a binary list but I did not manage to match the php-generated hash :
var buffer = new Buffer(16);
buffer.writeDoubleBE(10)
return crypto.createHash("md5").update(buffer).digest("hex");
// result : c6df1eeac30ad1fab5b50994e09033fb
// PHP-generated hash : md5(10) = d3d9446802a44259755d38e6d163e820
What exactly MD5 in php do with the data type ?
Which data form should i use to get the same result ?