You are here

public static function ParagonIE_Sodium_Core32_Ed25519::publickey_from_secretkey in Automatic Updates 8

Same name and namespace in other branches
  1. 7 vendor/paragonie/sodium_compat/src/Core32/Ed25519.php \ParagonIE_Sodium_Core32_Ed25519::publickey_from_secretkey()

@internal You should not use this directly from another application

Parameters

string $sk:

Return value

string

Throws

SodiumException

TypeError

2 calls to ParagonIE_Sodium_Core32_Ed25519::publickey_from_secretkey()
ParagonIE_Sodium_Compat::crypto_sign_publickey_from_secretkey in vendor/paragonie/sodium_compat/src/Compat.php
Calculate an Ed25519 public key from an Ed25519 secret key.
ParagonIE_Sodium_Core32_Ed25519::seed_keypair in vendor/paragonie/sodium_compat/src/Core32/Ed25519.php
@internal You should not use this directly from another application

File

vendor/paragonie/sodium_compat/src/Core32/Ed25519.php, line 93

Class

ParagonIE_Sodium_Core32_Ed25519
Class ParagonIE_Sodium_Core32_Ed25519

Code

public static function publickey_from_secretkey($sk) {

  /** @var string $sk */
  $sk = hash('sha512', self::substr($sk, 0, 32), true);
  $sk[0] = self::intToChr(self::chrToInt($sk[0]) & 248);
  $sk[31] = self::intToChr(self::chrToInt($sk[31]) & 63 | 64);
  return self::sk_to_pk($sk);
}