RPeraltaJr
9/4/2018 - 2:02 PM

Password Hash and Verify

<?php 

//on creating an account, a user enters a password!
$password = "password";//user keyed in password

$newhash = password_hash($password, PASSWORD_DEFAULT);
// echo $newhash;
//#newhash now has the only value that you need to store in the db
//you do not need any more than this value, that you retrieve when you 
//want to verify your password!

if ( password_verify($password, $newhash) ) {
    echo"verified";
}
else
{
    echo"Not verified"; 
}