php8.5
Home/ Manual/ sodium / functions/ sodium_crypto_box_keypair

sodium_crypto_box_keypair

PHP function Edit on GitHub ✎

(PHP 7 >= 7.2.0, PHP 8)

Randomly generate a secret key and a corresponding public key

Description

sodium_crypto_box_keypair(): string

Generates a secret key and a public key as one string.

To get the secret key out of this unified keypair string, see sodium_crypto_box_secretkey(). To get the public key out of this unified keypair string, see sodium_crypto_box_publickey().

Parameters Parameters

Return Values

One string containing both the X25519 secret key and corresponding X25519 public key.

Source: reference/sodium/functions/sodium-crypto-box-keypair.xml · from the official PHP manual (php/doc-en)