WordPress at a glance
function is not described

ParagonIE_Sodium_Compat::crypto_box_keypair() public WP 1.0

Generate a new random X25519 keypair.

{} It's a method of the class: ParagonIE_Sodium_Compat{}

No Hooks.


String. A 64-byte string; the first 32 are your secret key, while the last 32 are your public key. crypto_box_secretkey() and crypto_box_publickey() exist to separate them so you don't accidentally get them mixed up!


$result = ParagonIE_Sodium_Compat::crypto_box_keypair();

Code of ParagonIE_Sodium_Compat::crypto_box_keypair() WP 5.7.1

public static function crypto_box_keypair()
    if (self::useNewSodiumAPI()) {
        return (string) sodium_crypto_box_keypair();
    if (self::use_fallback('crypto_box_keypair')) {
        return (string) call_user_func('\\Sodium\\crypto_box_keypair');
    if (PHP_INT_SIZE === 4) {
        return ParagonIE_Sodium_Crypto32::box_keypair();
    return ParagonIE_Sodium_Crypto::box_keypair();