I want to use Argon2i to hash my password but it's not working. I get the following error:
Fatal error: Uncaught Error: Call to undefined function Sodium\crypto_pwhash_str()
// Password hashing:
$hash_str = \Sodium\crypto_pwhash_str(
The most likely cause for this problem is an outdated version of libsodium, often because Linux distribution patches erroneously only provide libsodium version 1.0.3 or 1.0.8 despite 1.0.11 being available.
Installing Libsodium in a PHP project requires installing two different things:
libsodium, the library itself
ext/libsodium, the PHP extension (if this becomes a core extension, we'll probably shorten it to
In order to use
\Sodium\crypto_pwhash_str(), two conditions must be met:
In Halite, we have a function called
Halite::isLibsodiumSetupCorrectly() to quickly diagnose version issues.
Your best best is: