You are here

public static function ParagonIE_Sodium_Compat::crypto_sign_seed_keypair in Automatic Updates 7

Same name and namespace in other branches
  1. 8 vendor/paragonie/sodium_compat/src/Compat.php \ParagonIE_Sodium_Compat::crypto_sign_seed_keypair()

Generate an Ed25519 keypair from a seed.

@psalm-suppress MixedArgument

Parameters

string $seed Input seed:

Return value

string Keypair

Throws

SodiumException

TypeError

2 calls to ParagonIE_Sodium_Compat::crypto_sign_seed_keypair()
php72compat.php in vendor/paragonie/sodium_compat/lib/php72compat.php
sodium_compat.php in vendor/paragonie/sodium_compat/lib/sodium_compat.php

File

vendor/paragonie/sodium_compat/src/Compat.php, line 2692

Class

ParagonIE_Sodium_Compat

Code

public static function crypto_sign_seed_keypair($seed) {
  ParagonIE_Sodium_Core_Util::declareScalarType($seed, 'string', 1);
  if (self::useNewSodiumAPI()) {
    return sodium_crypto_sign_seed_keypair($seed);
  }
  if (self::use_fallback('crypto_sign_keypair')) {
    return (string) call_user_func('\\Sodium\\crypto_sign_seed_keypair', $seed);
  }
  $publicKey = '';
  $secretKey = '';
  if (PHP_INT_SIZE === 4) {
    ParagonIE_Sodium_Core32_Ed25519::seed_keypair($publicKey, $secretKey, $seed);
  }
  else {
    ParagonIE_Sodium_Core_Ed25519::seed_keypair($publicKey, $secretKey, $seed);
  }
  return $secretKey . $publicKey;
}