ParagonIE_Sodium_Compat::crypto_kx_seed_keypair

Advertisement

Syntax Syntax

ParagonIE_Sodium_Compat::crypto_kx_seed_keypair( string $seed )

Parameters Parameters

$seed

(string) (Required)

Return Return

(string)

Source Source

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

    public static function crypto_kx_seed_keypair($seed)
    {
        ParagonIE_Sodium_Core_Util::declareScalarType($seed, 'string', 1);

        $seed = (string) $seed;

        if (ParagonIE_Sodium_Core_Util::strlen($seed) !== self::CRYPTO_KX_SEEDBYTES) {
            throw new SodiumException('seed must be SODIUM_CRYPTO_KX_SEEDBYTES bytes');
        }

        $sk = self::crypto_generichash($seed, '', self::CRYPTO_KX_SECRETKEYBYTES);
        $pk = self::crypto_scalarmult_base($sk);
        return $sk . $pk;
    }

Advertisement

Advertisement

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.