php Function sodium_crypto_Box_From_SecretKeyAndPublicKey
php function sodium_crypto_box_keypair_from_secretkey_and_publickey is used to generate an encryption key pair for two parties to communicate. This key pair is then used to encrypt and decrypt messages between these two parties. This type of asymmetric encryption ensures that only the intended recipient can read a message. A signature tag is also included in the encrypted message which can be used to authenticate a message against tampering.
Using this technique, it is possible to encrypt data such as passwords in a manner that only the intended recipient can read them. In addition, the original data cannot be reverse-engineered from a hash, making the hash useless to attackers. This is a good method to protect sensitive information from malicious attackers that might intercept or steal your data.
Another useful feature of the libsodium library is that all of its algorithms are authenticated, meaning that an authentication tag is added to each encrypted message that can be verified against tampering. This prevents Chosen-ciphertext attacks that can occur with other methods, such as mcrypt or most ciphers from OpenSSL.
PHP has long supported the Libsodium library as a PECL extension, but as of PHP 7.2, it is integrated into the core, so it's likely that you already have this library installed and enabled (you can check using phpinfo()). To compile PHP with Libsodium support, you need to use the --with-sodium flag or install the libsodium library, which can be found in repositories such as libsodium-dev on Ubuntu/Debian or libsodium-devel on Fedora/RHEL.