Function __global->sodium_crypto_secretbox
Definitions
sources_custom/phpstub.php
- Encrypt a message with a symmetric (shared) key.
- Visibility: public
- Is abstract?: No
- Is static?: No
- Is final?: No
- Returns: string
Parameters
| Name | Type | Passed by reference? | Variadic? | Default | Set | Range | Description |
|---|---|---|---|---|---|---|---|
| $message | string | No | No | required parameter | N/A | N/A | The plaintext message to encrypt |
| $nonce | string | No | No | required parameter | N/A | N/A | A random 24-byte string to use only for this encryption |
| $key | string | No | No | required parameter | N/A | N/A | The 256-bit encryption key to use |
Returns
- The encrypted text
- Type: string
- Set: N/A
- Range: N/A
Preview
Code (PHP)
/**
* Encrypt a message with a symmetric (shared) key.
*
* @param string $message The plaintext message to encrypt
* @param string $nonce A random 24-byte string to use only for this encryption
* @param string $key The 256-bit encryption key to use
* @return string The encrypted text
*/
function sodium_crypto_secretbox(string $message, string $nonce, string $key) : string
* Encrypt a message with a symmetric (shared) key.
*
* @param string $message The plaintext message to encrypt
* @param string $nonce A random 24-byte string to use only for this encryption
* @param string $key The 256-bit encryption key to use
* @return string The encrypted text
*/
function sodium_crypto_secretbox(string $message, string $nonce, string $key) : string

