Answered by : meaxis
// To hash the password, use
password_hash("MySuperSafePassword!", PASSWORD_DEFAULT)
// To compare hash with plain text, use
password_verify("MySuperSafePassword!", $hashed_password)
Source : | Last Update : Sun, 23 Feb 20
Answered by : filthy-falcon-wr4ag74g8t79
//hash password
$pass = password_hash($password, PASSWORD_DEFAULT);
//verify password
password_verify($password, $hashed_password); // returns true
Source : | Last Update : Sat, 18 Jul 20
Answered by : hamza-bin-sajid
/* User's password. */
$password = 'my secret password';
/* Secure password hash. */
$hash = password_hash($password, PASSWORD_DEFAULT);
Source : https://alexwebdevelop.com/php-password-hashing/ | Last Update : Mon, 26 Oct 20
Answered by : silly-seahorse-d8zqnd35sv3n
//hash password
$hashed_password = password_hash($password, PASSWORD_DEFAULT);
//verify password
password_verify($password, $hashed_password); // returns true
Source : https://stackoverflow.com/questions/30279321/how-to-use-phps-password-hash-to-hash-and-verify-passwords | Last Update : Fri, 10 Jul 20
Answered by : jappie313
<?php
/** * For the VAST majority of use-cases, let password_hash generate the salt randomly for you. */
$password = 'idkWhatToUse';
$hashedPassword= password_hash($password, PASSWORD_DEFAULT);
?>
Source : | Last Update : Wed, 30 Sep 20
Answered by : beautiful-baboon-fbwuy2qa7d1z
$password = 'test123';
/* Always use salt for security reasons. I'm using the BCRYPT algorithm use any valid one you like.
*/
$options['salt'] = 'usesomesillystringforsalt';
$options['cost'] = 3;
echo password_hash($password, PASSWORD_BCRYPT, $options)
Source : | Last Update : Mon, 06 Apr 20
Answered by : hamza-bin-sajid
<?php
/**
* In this case, we want to increase the default cost for BCRYPT to 12.
* Note that we also switched to BCRYPT, which will always be 60 characters.
*/
$options = [
'cost' => 12,
];
echo password_hash("rasmuslerdorf", PASSWORD_BCRYPT, $options);
?>
Source : https://www.php.net/manual/en/function.password-hash.php | Last Update : Mon, 26 Oct 20
Answered by : mohamed
<?php
echo hash('ripemd160', 'The quick brown fox jumped over the lazy dog.');
?>
Source : https://www.php.net/manual/en/function.hash.php | Last Update : Wed, 05 Aug 20
Answered by : hamza-bin-sajid
<?php
/**
* We just want to hash our password using the current DEFAULT algorithm.
* This is presently BCRYPT, and will produce a 60 character result.
*
* Beware that DEFAULT may change over time, so you would want to prepare
* By allowing your storage to expand past 60 characters (255 would be good)
*/
echo password_hash("rasmuslerdorf", PASSWORD_DEFAULT);
?>
Source : https://www.php.net/manual/en/function.password-hash.php | Last Update : Mon, 26 Oct 20
Answered by : hamza-bin-sajid
/* New password. */
$password = $_POST['password'];
/* Remember to validate the password. */
/* Create the new password hash. */
$hash = password_hash($password, PASSWORD_DEFAULT);
Source : https://alexwebdevelop.com/php-password-hashing/ | Last Update : Mon, 26 Oct 20