Standard DES: stqAdD7zlbByI
Extended DES: _S4..someQXidlBpTUu6
CRYPT_MD5 : $1$somethin$4NZKrUlY6r7K7.rdEOZ0w.
Blowfish: $2a$09$anexamplestringforsaleLouKejcjRlExmf1671qw3Khl49R3dfu
SHA-256: $5$rounds=5000$anexamplestringf$KIrct ↵
qsxo2wrPg5Ag/hs4jTi4PmoNKQUGWFXlVy9vu
SHA-512: $6$rounds=5000$anexamplestringf$Oo0skOAdUFXkQxJpwzO05wgRHG0 ↵
dhuaPBaOU/oNbGpCEKlf/7oVM5wn6AN0w2vwUgA0O24oLzGQpp1XKI6LLQ0
Source ➠ http://www.w3schools.com/php/func_string_crypt.asp
More info ➠ http://php.net/manual/en/faq.passwords.php
Create hash ➠ http://php.net/manual/en/function.password-hash.php
Verify hash ➠ http://php.net/manual/en/function.password-verify.php
If your PHP version (> 5.3.7 AND < 5.5.0) does not support the password_hash() function (You'll get an internal server error and you won't see output) then use this library :
➠ https://github.com/ircmaxell/password_compat
$hash = password_hash("rasmuslerdorf", PASSWORD_DEFAULT);
echo "<p>password hash() : " . $hash . "</p>";
if (password_verify('rasmuslerdorf', $hash)) {
echo '<p>Password is valid!</p>';
} else {
echo '<p>Invalid password.</p>';
}
password hash() : $2y$10$ttjXvNVgSpyVphw7GGZOJ.7C5hWR2IJ5PbphkzLm25l9qw4A9hQga
Password is valid!
$hash3 = password_hash("rasmuslerdorf", PASSWORD_BCRYPT);
echo "<p>password hash with bcrypt only : " . $hash3 . "</p>";
password hash with bcrypt only : $2y$10$NdI1CQQuHNBa1mYEHvJHoe6qeztxCY70ehkVqlvsgq3mPdj1wrfP.
$options = [
'cost' => 12,
];
$hash2 = password_hash("rasmuslerdorf", PASSWORD_BCRYPT, $options);
echo "<p>password hash with bcrypt and cost : " . $hash2 . "</p>\n";
if (password_verify('rasmuslerdorf', $hash)) {
echo '<p>Password is valid!</p>';
} else {
echo '<p>Invalid password.</p>';
}
password hash with bcrypt and cost : $2y$12$eQpHbzL74gZ/L1Kigr30HONgoGymi604u9qJF0cYQRnK9dG1eqfpi
Password is valid!
time : 0.558s