: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
if (!is_callable('sodium_crypto_secretstream_xchacha20poly1305_init_pull')) {
function sodium_crypto_secretstream_xchacha20poly1305_init_pull($header, $key)
return ParagonIE_Sodium_Compat::crypto_secretstream_xchacha20poly1305_init_pull($header, $key);
if (!is_callable('sodium_crypto_secretstream_xchacha20poly1305_pull')) {
* @param string $ciphertext
* @param string $additional_data
* @return bool|array{0: string, 1: int}
* @throws SodiumException
function sodium_crypto_secretstream_xchacha20poly1305_pull(&$state, $ciphertext, $additional_data = '')
return ParagonIE_Sodium_Compat::crypto_secretstream_xchacha20poly1305_pull(
if (!is_callable('sodium_crypto_secretstream_xchacha20poly1305_rekey')) {
* @throws SodiumException
function sodium_crypto_secretstream_xchacha20poly1305_rekey(&$state)
ParagonIE_Sodium_Compat::crypto_secretstream_xchacha20poly1305_rekey($state);
if (!is_callable('sodium_crypto_secretstream_xchacha20poly1305_keygen')) {
function sodium_crypto_secretstream_xchacha20poly1305_keygen()
return ParagonIE_Sodium_Compat::crypto_secretstream_xchacha20poly1305_keygen();
if (!is_callable('sodium_crypto_shorthash')) {
* @see ParagonIE_Sodium_Compat::crypto_shorthash()
* @throws SodiumException
function sodium_crypto_shorthash($message, $key = '')
return ParagonIE_Sodium_Compat::crypto_shorthash($message, $key);
if (!is_callable('sodium_crypto_shorthash_keygen')) {
* @see ParagonIE_Sodium_Compat::crypto_shorthash_keygen()
function sodium_crypto_shorthash_keygen()
return ParagonIE_Sodium_Compat::crypto_shorthash_keygen();
if (!is_callable('sodium_crypto_sign')) {
* @see ParagonIE_Sodium_Compat::crypto_sign()
* @param string $secret_key
* @throws SodiumException
function sodium_crypto_sign($message, $secret_key)
return ParagonIE_Sodium_Compat::crypto_sign($message, $secret_key);
if (!is_callable('sodium_crypto_sign_detached')) {
* @see ParagonIE_Sodium_Compat::crypto_sign_detached()
* @param string $secret_key
* @throws SodiumException
function sodium_crypto_sign_detached($message, $secret_key)
return ParagonIE_Sodium_Compat::crypto_sign_detached($message, $secret_key);
if (!is_callable('sodium_crypto_sign_keypair_from_secretkey_and_publickey')) {
* @see ParagonIE_Sodium_Compat::crypto_sign_keypair_from_secretkey_and_publickey()
* @param string $secret_key
* @param string $public_key
* @throws SodiumException
function sodium_crypto_sign_keypair_from_secretkey_and_publickey($secret_key, $public_key)
return ParagonIE_Sodium_Compat::crypto_sign_keypair_from_secretkey_and_publickey($secret_key, $public_key);
if (!is_callable('sodium_crypto_sign_keypair')) {
* @see ParagonIE_Sodium_Compat::crypto_sign_keypair()
* @throws SodiumException
function sodium_crypto_sign_keypair()
return ParagonIE_Sodium_Compat::crypto_sign_keypair();
if (!is_callable('sodium_crypto_sign_open')) {
* @see ParagonIE_Sodium_Compat::crypto_sign_open()
* @param string $signedMessage
* @param string $public_key
function sodium_crypto_sign_open($signedMessage, $public_key)
return ParagonIE_Sodium_Compat::crypto_sign_open($signedMessage, $public_key);
} catch (Exception $ex) {
if (!is_callable('sodium_crypto_sign_publickey')) {
* @see ParagonIE_Sodium_Compat::crypto_sign_publickey()
* @param string $key_pair
* @throws SodiumException
function sodium_crypto_sign_publickey($key_pair)
return ParagonIE_Sodium_Compat::crypto_sign_publickey($key_pair);
if (!is_callable('sodium_crypto_sign_publickey_from_secretkey')) {
* @see ParagonIE_Sodium_Compat::crypto_sign_publickey_from_secretkey()
* @param string $secret_key
* @throws SodiumException
function sodium_crypto_sign_publickey_from_secretkey($secret_key)
return ParagonIE_Sodium_Compat::crypto_sign_publickey_from_secretkey($secret_key);
if (!is_callable('sodium_crypto_sign_secretkey')) {
* @see ParagonIE_Sodium_Compat::crypto_sign_secretkey()
* @param string $key_pair
* @throws SodiumException
function sodium_crypto_sign_secretkey($key_pair)
return ParagonIE_Sodium_Compat::crypto_sign_secretkey($key_pair);
if (!is_callable('sodium_crypto_sign_seed_keypair')) {
* @see ParagonIE_Sodium_Compat::crypto_sign_seed_keypair()
* @throws SodiumException
function sodium_crypto_sign_seed_keypair($seed)
return ParagonIE_Sodium_Compat::crypto_sign_seed_keypair($seed);
if (!is_callable('sodium_crypto_sign_verify_detached')) {
* @see ParagonIE_Sodium_Compat::crypto_sign_verify_detached()
* @param string $signature
* @param string $public_key
* @throws SodiumException
function sodium_crypto_sign_verify_detached($signature, $message, $public_key)
return ParagonIE_Sodium_Compat::crypto_sign_verify_detached($signature, $message, $public_key);
if (!is_callable('sodium_crypto_sign_ed25519_pk_to_curve25519')) {
* @see ParagonIE_Sodium_Compat::crypto_sign_ed25519_pk_to_curve25519()
* @param string $public_key
* @throws SodiumException
function sodium_crypto_sign_ed25519_pk_to_curve25519($public_key)
return ParagonIE_Sodium_Compat::crypto_sign_ed25519_pk_to_curve25519($public_key);
if (!is_callable('sodium_crypto_sign_ed25519_sk_to_curve25519')) {
* @see ParagonIE_Sodium_Compat::crypto_sign_ed25519_sk_to_curve25519()
* @param string $secret_key
* @throws SodiumException
function sodium_crypto_sign_ed25519_sk_to_curve25519($secret_key)
return ParagonIE_Sodium_Compat::crypto_sign_ed25519_sk_to_curve25519($secret_key);
if (!is_callable('sodium_crypto_stream')) {
* @see ParagonIE_Sodium_Compat::crypto_stream()
* @throws SodiumException
function sodium_crypto_stream($length, $nonce, $key)
return ParagonIE_Sodium_Compat::crypto_stream($length, $nonce, $key);
if (!is_callable('sodium_crypto_stream_keygen')) {
* @see ParagonIE_Sodium_Compat::crypto_stream_keygen()
function sodium_crypto_stream_keygen()
return ParagonIE_Sodium_Compat::crypto_stream_keygen();
if (!is_callable('sodium_crypto_stream_xor')) {
* @see ParagonIE_Sodium_Compat::crypto_stream_xor()
* @throws SodiumException
function sodium_crypto_stream_xor($message, $nonce, $key)
return ParagonIE_Sodium_Compat::crypto_stream_xor($message, $nonce, $key);
require_once dirname(__FILE__) . '/stream-xchacha20.php';
if (!is_callable('sodium_hex2bin')) {
* @see ParagonIE_Sodium_Compat::hex2bin()
* @throws SodiumException
function sodium_hex2bin($string, $ignore = '')
return ParagonIE_Sodium_Compat::hex2bin($string, $ignore);
if (!is_callable('sodium_increment')) {
* @see ParagonIE_Sodium_Compat::increment()
* @throws SodiumException
function sodium_increment(&$string)
ParagonIE_Sodium_Compat::increment($string);
if (!is_callable('sodium_library_version_major')) {
* @see ParagonIE_Sodium_Compat::library_version_major()
function sodium_library_version_major()
return ParagonIE_Sodium_Compat::library_version_major();
if (!is_callable('sodium_library_version_minor')) {
* @see ParagonIE_Sodium_Compat::library_version_minor()
function sodium_library_version_minor()
return ParagonIE_Sodium_Compat::library_version_minor();
if (!is_callable('sodium_version_string')) {
* @see ParagonIE_Sodium_Compat::version_string()
function sodium_version_string()
return ParagonIE_Sodium_Compat::version_string();
if (!is_callable('sodium_memcmp')) {
* @see ParagonIE_Sodium_Compat::memcmp()
* @throws SodiumException
function sodium_memcmp($string1, $string2)
return ParagonIE_Sodium_Compat::memcmp($string1, $string2);
if (!is_callable('sodium_memzero')) {
* @see ParagonIE_Sodium_Compat::memzero()
* @throws SodiumException
* @psalm-suppress ReferenceConstraintViolation
function sodium_memzero(&$string)
ParagonIE_Sodium_Compat::memzero($string);
if (!is_callable('sodium_pad')) {
* @see ParagonIE_Sodium_Compat::pad()
* @param string $unpadded
* @throws SodiumException
function sodium_pad($unpadded, $block_size)
return ParagonIE_Sodium_Compat::pad($unpadded, $block_size, true);
if (!is_callable('sodium_unpad')) {
* @see ParagonIE_Sodium_Compat::pad()
* @throws SodiumException
function sodium_unpad($padded, $block_size)
return ParagonIE_Sodium_Compat::unpad($padded, $block_size, true);
if (!is_callable('sodium_randombytes_buf')) {
* @see ParagonIE_Sodium_Compat::randombytes_buf()
function sodium_randombytes_buf($amount)
return ParagonIE_Sodium_Compat::randombytes_buf($amount);
if (!is_callable('sodium_randombytes_uniform')) {
* @see ParagonIE_Sodium_Compat::randombytes_uniform()
function sodium_randombytes_uniform($upperLimit)
return ParagonIE_Sodium_Compat::randombytes_uniform($upperLimit);
if (!is_callable('sodium_randombytes_random16')) {
* @see ParagonIE_Sodium_Compat::randombytes_random16()
function sodium_randombytes_random16()
return ParagonIE_Sodium_Compat::randombytes_random16();