- var_dump: documentation ( source)
- bin2hex: documentation ( source)
<?php
$keypair = sodium_crypto_box_keypair();
$sk = sodium_crypto_box_secretkey($keypair);
$pk = sodium_crypto_box_publickey($keypair);
var_dump([
'secret key' => bin2hex($sk),
'public key' => bin2hex($pk)
]);
$pk_from_sk = sodium_crypto_scalarmult_base($sk);
var_dump([
'public key from secret key' => bin2hex($pk_from_sk)
]);