Looking for Perl crypt() function in node.js.
perl -e 'print crypt("", "12345")'
return: 12UFlHxel6uMM
Looking the same in node.js
Looking for Perl crypt() function in node.js.
perl -e 'print crypt("", "12345")'
return: 12UFlHxel6uMM
Looking the same in node.js
There is a powerful and well supported node package for password encryption - bcrypt.
What you want is:
var bcrypt = require('bcrypt');
var hash = bcrypt.hashSync('', '12345');
See bcrypt API Docs for more info.
Updated. You can also use Node crypto module. In this case you may use crypto.pbkdf2
method. I newer used it myself, so I can't guarantee its stability, usability and security.
I also can't guarantee than either bcrypt or crypto uses the same algorithm for password hashing as Perl crypt method. So the result may be different from Perl crypt even if salt is the same.
Though Node crypto is a build-in module, I strongly recommend you to use bcrypt if possible, because its more secure.