You are here

public static function ParagonIE_Sodium_Compat::crypto_box_keypair in Automatic Updates 7

Same name and namespace in other branches
  1. 8 vendor/paragonie/sodium_compat/src/Compat.php \ParagonIE_Sodium_Compat::crypto_box_keypair()

Generate a new random X25519 keypair.

@psalm-suppress MixedArgument

Return value

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!

Throws

SodiumException

TypeError

3 calls to ParagonIE_Sodium_Compat::crypto_box_keypair()
ParagonIE_Sodium_File::box_seal in vendor/paragonie/sodium_compat/src/File.php
Seal a file (rather than a string). Uses less memory than ParagonIE_Sodium_Compat::crypto_box_seal(), but produces the same result.
php72compat.php in vendor/paragonie/sodium_compat/lib/php72compat.php
sodium_compat.php in vendor/paragonie/sodium_compat/lib/sodium_compat.php

File

vendor/paragonie/sodium_compat/src/Compat.php, line 1165

Class

ParagonIE_Sodium_Compat

Code

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