Skip to content

Instantly share code, notes, and snippets.

Created March 27, 2017 04:41
What would you like to do?
Demo of simple password hashing in 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