ParagonIE_Sodium_Compat::crypto_box_keypair

Advertisement

Summery Summery

Generate a new random X25519 keypair.

Syntax Syntax

ParagonIE_Sodium_Compat::crypto_box_keypair()

Return Return

(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!

Source Source

File: wp-includes/sodium_compat/src/Compat.php

    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();
    }

Advertisement

Advertisement

Leave a Reply