I’m trying to do a function to hash passwords with this php function: http://be.php.net/manual/en/function.hash-pbkdf2.php.
Here is the code:
$hash_algo = "sha256";
$password = "password";
$salt = "salt";
$iterations = 1;
$length = 1;
$raw_output = false;
$hash = hash_pbkdf2($hash_algo, $password, $salt, $iterations ,$length ,$raw_output);
echo $hash;
I got this error: Fatal error: Call to undefined function hash_pbkdf2().
How can the function be undefined???
PS: All the values of my variables are set just for testing the function. Obviously the salt will not be “salt”, etc.
EDIT: As of
PHP 5.5.0this function is now bundled into the core library.This function is not (yet anyway) available in core PHP. It was proposed not that long ago and so far you can only get it as a patch.
You can use
cryptorhashinstead.cryptis actually suggested inhash_pbkdf2documentation: