Demo of simple password hashing in PHP.
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 | |
$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