ParagonIE_Sodium_Compat::crypto_sign_ed25519_pk_to_curve25519() public WP 1.0
Convert an Ed25519 public key to a Curve25519 public key
{} It's a method of the class: ParagonIE_Sodium_Compat{}
No Hooks.
Return
String
. Null. Nothing.
Usage
$result = ParagonIE_Sodium_Compat::crypto_sign_ed25519_pk_to_curve25519( $pk );
- $pk(string) (required)
- -
Code of ParagonIE_Sodium_Compat::crypto_sign_ed25519_pk_to_curve25519() ParagonIE Sodium Compat::crypto sign ed25519 pk to curve25519 WP 5.7
public static function crypto_sign_ed25519_pk_to_curve25519($pk)
{
/* Type checks: */
ParagonIE_Sodium_Core_Util::declareScalarType($pk, 'string', 1);
/* Input validation: */
if (ParagonIE_Sodium_Core_Util::strlen($pk) < self::CRYPTO_SIGN_PUBLICKEYBYTES) {
throw new SodiumException('Argument 1 must be at least CRYPTO_SIGN_PUBLICKEYBYTES long.');
}
if (self::useNewSodiumAPI()) {
if (is_callable('crypto_sign_ed25519_pk_to_curve25519')) {
return (string) sodium_crypto_sign_ed25519_pk_to_curve25519($pk);
}
}
if (self::use_fallback('crypto_sign_ed25519_pk_to_curve25519')) {
return (string) call_user_func('\\Sodium\\crypto_sign_ed25519_pk_to_curve25519', $pk);
}
if (PHP_INT_SIZE === 4) {
return ParagonIE_Sodium_Core32_Ed25519::pk_to_curve25519($pk);
}
return ParagonIE_Sodium_Core_Ed25519::pk_to_curve25519($pk);
}