Password Hashing
You can use PHP password_hash() function for hashing the password with multiple algorithms. Here is an example:-
$password = "dskjfk111!";
$hashed_password = password_hash($password, PASSWORD_DEFAULT);
You can provide different algorithms in second parameter. I used PASSWORD_DEFAULT which use bcrypt algorithm.
Password Verification
The hashed password generated by password_hash() function has algorithm, salt and cost as part of the output (hashed password). So by using password_verify() function, you can verify the password without providing algorithm used during hashing. Here is an example:-
$user_input = "dskjfk111!";
$result = password_verify($user_input);
if($result){
echo "Password Valid"
}else{
echo "Password Invalid"
}
md5() or sha1()
Don't use md5() or sha1() functions for password. As you can read about it in php.net documentation.