9951 explained code solutions for 126 technologies


phpHow to hash password


password_hash('pwd', PASSWORD_DEFAULT);ctrl + c
password_hash

create password hash string (use password_verify() to validate inputs then)

'pwd'

password string to hash

PASSWORD_DEFAULT

type of hasher to use


Usage example

$hash = password_hash('pwd', PASSWORD_DEFAULT);
if ( password_verify($_POST['password'], $hash) ) {
  echo 'Correct password';
}
output
Correct password # When "pwd" password is posted