개발모음집

Compare data stored as password_hash in PHP with js 본문

Server/node.js

Compare data stored as password_hash in PHP with js

void 2020. 3. 23. 10:00

 

password_hash($password,PASSWORD_BCRYPT)

위의 코드같이 php password_hash로 저장한 데이터를 

 bcrypt.compare(input.password, database.password.replace(/^\$2y(.+)$/i, '\$2a$1'),
                    function(err, result) {
    console.log(result);
});

위 js 코드로 확인할 수 있다.

 

출처 : https://stackoverflow.com/questions/27928873/passwordsalt-hashing-and-verifying-in-php-and-or-nodejs