password hash - what is best way of using password_hash and password_verify -
using md5 (old way):
$sql = "select * 'table' `username`='bob' , `password`='123456'";
** check password before getting data out of database.
using password_hash , password_verify (new way):
$sql = "select `password` 'table' `username`='bob'"; $bool = password_verify('password_from_post_method', 'password_from_database'); if($bool) {echo "your password right";}
** data got database first, , check password out of database.
*** think old way better. data out of database when confirm password right. maybe, use password_hash , password_verify in wrong way. please give suggestion if have idea. thanks.
you persist [hashed(password) + randomsalt] in password column of database. can write sql have mentioned in approach 1, during verification ? can not, because random generated salt persisted along password. why 'new way' way go.
Comments
Post a Comment