Created
December 2, 2017 00:48
-
-
Save legomolina/8c42b24b3950c41802f74a9a896e8ef2 to your computer and use it in GitHub Desktop.
Simple snippet to create a hashed password via php command line
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if(count($argv) <= 1) { | |
print "Usage: php -f password.php mypassword [cost = 10]\n\n"; | |
exit(); | |
} | |
$password = $argv[1]; | |
$cost = (count($argv) > 2) ? $argv[2] : 10; | |
$encPass = password_hash($password, PASSWORD_BCRYPT, array("cost" => $cost)); | |
print "$encPass\n\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment