Created
May 29, 2019 13:44
-
-
Save Just1B/c71cfb62c91424bae22ddf198b8d9e71 to your computer and use it in GitHub Desktop.
Revisions
-
Justin created this gist
May 29, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ const bcrypt = require('bcryptjs'); const exec = require('child_process').exec const password = 'test'; const cmd = '/usr/local/bin/php ./password.php' exec(cmd, (err, stdout, stderr) => { // See https://en.wikipedia.org/wiki/Bcrypt#Versioning_history const hash = stdout.replace('$2y$', '$2a$'); bcrypt.compare(password, hash).then(function(res) { // Should output true console.log(res); }); }); This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,5 @@ <?php $password = "test"; $hash = password_hash($password, PASSWORD_BCRYPT);