Created
March 27, 2017 04:41
-
-
Save rochellelewis/35c72c0c774476d4c7e86f282dc5175d to your computer and use it in GitHub Desktop.
Demo of simple password hashing in PHP.
This file contains hidden or 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 | |
$pass = "password123"; | |
$activationToken = bin2hex(random_bytes(16)); | |
$salt = bin2hex(random_bytes(16)); | |
$hash = hash_pbkdf2("sha512", $pass, $salt, 262144); | |
echo "The following values are good for SALT and ACTIVATION that are CHAR(32) data, and HASH that is CHAR(128) data."; | |
echo "password: " . $pass . "\n\n"; | |
echo "activation token" . $activationToken . "\n\n"; | |
echo "salt: " . $salt . "\n\n"; | |
echo "password hash: " . $hash . "\n\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment