Search code examples
phpnode.jscrypt

Node js sha512 is equivalent to PHP?


I am using PHP for admin panel but somehow client needs to integrate frontend in nodejs with pug template engine, i need little help for password encryption, is sha512('mystring') of nodejs equivalent to PHP hash('sha512','mystring') . ?

I am using this Link for node js encryption https://www.npmjs.com/package/js-sha512

For PHP http://php.net/manual/en/function.hash.php


Solution

  • Hope it will help to someone else

    I Got the answer by this Link https://www.hacksparrow.com/how-to-generate-md5-sha1-sha512-sha256-checksum-hashes-in-node-js.html

    var sha512 = crypto.createHash('sha512').update('mystring').digest("hex");
    

    It's generating same output like php hash('sha512','mystring')

    Thanks Everyone