public static function ParagonIE_Sodium_Compat::crypto_kx_seed_keypair in Automatic Updates 7
Same name and namespace in other branches
- 8 vendor/paragonie/sodium_compat/src/Compat.php \ParagonIE_Sodium_Compat::crypto_kx_seed_keypair()
Parameters
string $seed:
Return value
string
Throws
SodiumException
1 call to ParagonIE_Sodium_Compat::crypto_kx_seed_keypair()
- php72compat.php in vendor/
paragonie/ sodium_compat/ lib/ php72compat.php
File
- vendor/
paragonie/ sodium_compat/ src/ Compat.php, line 1758
Class
Code
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;
}