PHP 7 >= 7.2.0, PHP 8
sodium_crypto_secretbox_keygen - Generate random key for sodium_crypto_secretbox
Code Examples

sodium_crypto_secretbox_keygen( ): string

Generate a key for use with sodium_crypto_secretbox and sodium_crypto_secretbox_open.


This function has no parameters.

Return Values

Returns the generated string of cryptographically secure random bytes.

Related Functions

Example of sodium_crypto_secretbox_keygen

Show all examples for sodium_crypto_secretbox_keygen

PHP Version:

Function sodium_crypto_secretbox_keygen:

Sodium Functions

Most used PHP functions