You are here

public static function ParagonIE_Sodium_Crypto32::box_keypair in Automatic Updates 7

Same name and namespace in other branches
  1. 8 vendor/paragonie/sodium_compat/src/Crypto32.php \ParagonIE_Sodium_Crypto32::box_keypair()

@internal Do not use this directly. Use ParagonIE_Sodium_Compat.

Return value

string

Throws

Exception

SodiumException

TypeError

2 calls to ParagonIE_Sodium_Crypto32::box_keypair()
ParagonIE_Sodium_Compat::crypto_box_keypair in vendor/paragonie/sodium_compat/src/Compat.php
Generate a new random X25519 keypair.
ParagonIE_Sodium_Crypto32::box_seal in vendor/paragonie/sodium_compat/src/Crypto32.php
X25519-XSalsa20-Poly1305 with one ephemeral X25519 keypair.

File

vendor/paragonie/sodium_compat/src/Crypto32.php, line 559

Class

ParagonIE_Sodium_Crypto32
Class ParagonIE_Sodium_Crypto

Code

public static function box_keypair() {
  $sKey = random_bytes(32);
  $pKey = self::scalarmult_base($sKey);
  return $sKey . $pKey;
}