You are here

abstract class ParagonIE_Sodium_Core_Ed25519 in Automatic Updates 8

Same name and namespace in other branches
  1. 7 vendor/paragonie/sodium_compat/src/Core/Ed25519.php \ParagonIE_Sodium_Core_Ed25519

Class ParagonIE_Sodium_Core_Ed25519

Hierarchy

Expanded class hierarchy of ParagonIE_Sodium_Core_Ed25519

1 string reference to 'ParagonIE_Sodium_Core_Ed25519'
Ed25519.php in vendor/paragonie/sodium_compat/src/Core/Ed25519.php

File

vendor/paragonie/sodium_compat/src/Core/Ed25519.php, line 10

View source
abstract class ParagonIE_Sodium_Core_Ed25519 extends ParagonIE_Sodium_Core_Curve25519 {
  const KEYPAIR_BYTES = 96;
  const SEED_BYTES = 32;

  /**
   * @internal You should not use this directly from another application
   *
   * @return string (96 bytes)
   * @throws Exception
   * @throws SodiumException
   * @throws TypeError
   */
  public static function keypair() {
    $seed = random_bytes(self::SEED_BYTES);
    $pk = '';
    $sk = '';
    self::seed_keypair($pk, $sk, $seed);
    return $sk . $pk;
  }

  /**
   * @internal You should not use this directly from another application
   *
   * @param string $pk
   * @param string $sk
   * @param string $seed
   * @return string
   * @throws SodiumException
   * @throws TypeError
   */
  public static function seed_keypair(&$pk, &$sk, $seed) {
    if (self::strlen($seed) !== self::SEED_BYTES) {
      throw new RangeException('crypto_sign keypair seed must be 32 bytes long');
    }

    /** @var string $pk */
    $pk = self::publickey_from_secretkey($seed);
    $sk = $seed . $pk;
    return $sk;
  }

  /**
   * @internal You should not use this directly from another application
   *
   * @param string $keypair
   * @return string
   * @throws TypeError
   */
  public static function secretkey($keypair) {
    if (self::strlen($keypair) !== self::KEYPAIR_BYTES) {
      throw new RangeException('crypto_sign keypair must be 96 bytes long');
    }
    return self::substr($keypair, 0, 64);
  }

  /**
   * @internal You should not use this directly from another application
   *
   * @param string $keypair
   * @return string
   * @throws TypeError
   */
  public static function publickey($keypair) {
    if (self::strlen($keypair) !== self::KEYPAIR_BYTES) {
      throw new RangeException('crypto_sign keypair must be 96 bytes long');
    }
    return self::substr($keypair, 64, 32);
  }

  /**
   * @internal You should not use this directly from another application
   *
   * @param string $sk
   * @return string
   * @throws SodiumException
   * @throws TypeError
   */
  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);
  }

  /**
   * @param string $pk
   * @return string
   * @throws SodiumException
   * @throws TypeError
   */
  public static function pk_to_curve25519($pk) {
    if (self::small_order($pk)) {
      throw new SodiumException('Public key is on a small order');
    }
    $A = self::ge_frombytes_negate_vartime(self::substr($pk, 0, 32));
    $p1 = self::ge_mul_l($A);
    if (!self::fe_isnonzero($p1->X)) {
      throw new SodiumException('Unexpected zero result');
    }

    # fe_1(one_minus_y);

    # fe_sub(one_minus_y, one_minus_y, A.Y);

    # fe_invert(one_minus_y, one_minus_y);
    $one_minux_y = self::fe_invert(self::fe_sub(self::fe_1(), $A->Y));

    # fe_1(x);

    # fe_add(x, x, A.Y);

    # fe_mul(x, x, one_minus_y);
    $x = self::fe_mul(self::fe_add(self::fe_1(), $A->Y), $one_minux_y);

    # fe_tobytes(curve25519_pk, x);
    return self::fe_tobytes($x);
  }

  /**
   * @internal You should not use this directly from another application
   *
   * @param string $sk
   * @return string
   * @throws SodiumException
   * @throws TypeError
   */
  public static function sk_to_pk($sk) {
    return self::ge_p3_tobytes(self::ge_scalarmult_base(self::substr($sk, 0, 32)));
  }

  /**
   * @internal You should not use this directly from another application
   *
   * @param string $message
   * @param string $sk
   * @return string
   * @throws SodiumException
   * @throws TypeError
   */
  public static function sign($message, $sk) {

    /** @var string $signature */
    $signature = self::sign_detached($message, $sk);
    return $signature . $message;
  }

  /**
   * @internal You should not use this directly from another application
   *
   * @param string $message A signed message
   * @param string $pk      Public key
   * @return string         Message (without signature)
   * @throws SodiumException
   * @throws TypeError
   */
  public static function sign_open($message, $pk) {

    /** @var string $signature */
    $signature = self::substr($message, 0, 64);

    /** @var string $message */
    $message = self::substr($message, 64);
    if (self::verify_detached($signature, $message, $pk)) {
      return $message;
    }
    throw new SodiumException('Invalid signature');
  }

  /**
   * @internal You should not use this directly from another application
   *
   * @param string $message
   * @param string $sk
   * @return string
   * @throws SodiumException
   * @throws TypeError
   */
  public static function sign_detached($message, $sk) {

    # crypto_hash_sha512(az, sk, 32);
    $az = hash('sha512', self::substr($sk, 0, 32), true);

    # az[0] &= 248;

    # az[31] &= 63;

    # az[31] |= 64;
    $az[0] = self::intToChr(self::chrToInt($az[0]) & 248);
    $az[31] = self::intToChr(self::chrToInt($az[31]) & 63 | 64);

    # crypto_hash_sha512_init(&hs);

    # crypto_hash_sha512_update(&hs, az + 32, 32);

    # crypto_hash_sha512_update(&hs, m, mlen);

    # crypto_hash_sha512_final(&hs, nonce);
    $hs = hash_init('sha512');
    hash_update($hs, self::substr($az, 32, 32));
    hash_update($hs, $message);
    $nonceHash = hash_final($hs, true);

    # memmove(sig + 32, sk + 32, 32);
    $pk = self::substr($sk, 32, 32);

    # sc_reduce(nonce);

    # ge_scalarmult_base(&R, nonce);

    # ge_p3_tobytes(sig, &R);
    $nonce = self::sc_reduce($nonceHash) . self::substr($nonceHash, 32);
    $sig = self::ge_p3_tobytes(self::ge_scalarmult_base($nonce));

    # crypto_hash_sha512_init(&hs);

    # crypto_hash_sha512_update(&hs, sig, 64);

    # crypto_hash_sha512_update(&hs, m, mlen);

    # crypto_hash_sha512_final(&hs, hram);
    $hs = hash_init('sha512');
    hash_update($hs, self::substr($sig, 0, 32));
    hash_update($hs, self::substr($pk, 0, 32));
    hash_update($hs, $message);
    $hramHash = hash_final($hs, true);

    # sc_reduce(hram);

    # sc_muladd(sig + 32, hram, az, nonce);
    $hram = self::sc_reduce($hramHash);
    $sigAfter = self::sc_muladd($hram, $az, $nonce);
    $sig = self::substr($sig, 0, 32) . self::substr($sigAfter, 0, 32);
    try {
      ParagonIE_Sodium_Compat::memzero($az);
    } catch (SodiumException $ex) {
      $az = null;
    }
    return $sig;
  }

  /**
   * @internal You should not use this directly from another application
   *
   * @param string $sig
   * @param string $message
   * @param string $pk
   * @return bool
   * @throws SodiumException
   * @throws TypeError
   */
  public static function verify_detached($sig, $message, $pk) {
    if (self::strlen($sig) < 64) {
      throw new SodiumException('Signature is too short');
    }
    if (self::chrToInt($sig[63]) & 240 && self::check_S_lt_L(self::substr($sig, 32, 32))) {
      throw new SodiumException('S < L - Invalid signature');
    }
    if (self::small_order($sig)) {
      throw new SodiumException('Signature is on too small of an order');
    }
    if ((self::chrToInt($sig[63]) & 224) !== 0) {
      throw new SodiumException('Invalid signature');
    }
    $d = 0;
    for ($i = 0; $i < 32; ++$i) {
      $d |= self::chrToInt($pk[$i]);
    }
    if ($d === 0) {
      throw new SodiumException('All zero public key');
    }

    /** @var bool The original value of ParagonIE_Sodium_Compat::$fastMult */
    $orig = ParagonIE_Sodium_Compat::$fastMult;

    // Set ParagonIE_Sodium_Compat::$fastMult to true to speed up verification.
    ParagonIE_Sodium_Compat::$fastMult = true;

    /** @var ParagonIE_Sodium_Core_Curve25519_Ge_P3 $A */
    $A = self::ge_frombytes_negate_vartime($pk);

    /** @var string $hDigest */
    $hDigest = hash('sha512', self::substr($sig, 0, 32) . self::substr($pk, 0, 32) . $message, true);

    /** @var string $h */
    $h = self::sc_reduce($hDigest) . self::substr($hDigest, 32);

    /** @var ParagonIE_Sodium_Core_Curve25519_Ge_P2 $R */
    $R = self::ge_double_scalarmult_vartime($h, $A, self::substr($sig, 32));

    /** @var string $rcheck */
    $rcheck = self::ge_tobytes($R);

    // Reset ParagonIE_Sodium_Compat::$fastMult to what it was before.
    ParagonIE_Sodium_Compat::$fastMult = $orig;
    return self::verify_32($rcheck, self::substr($sig, 0, 32));
  }

  /**
   * @internal You should not use this directly from another application
   *
   * @param string $S
   * @return bool
   * @throws SodiumException
   * @throws TypeError
   */
  public static function check_S_lt_L($S) {
    if (self::strlen($S) < 32) {
      throw new SodiumException('Signature must be 32 bytes');
    }
    $L = array(
      0xed,
      0xd3,
      0xf5,
      0x5c,
      0x1a,
      0x63,
      0x12,
      0x58,
      0xd6,
      0x9c,
      0xf7,
      0xa2,
      0xde,
      0xf9,
      0xde,
      0x14,
      0x0,
      0x0,
      0x0,
      0x0,
      0x0,
      0x0,
      0x0,
      0x0,
      0x0,
      0x0,
      0x0,
      0x0,
      0x0,
      0x0,
      0x0,
      0x10,
    );
    $c = 0;
    $n = 1;
    $i = 32;

    /** @var array<int, int> $L */
    do {
      --$i;
      $x = self::chrToInt($S[$i]);
      $c |= $x - $L[$i] >> 8 & $n;
      $n &= ($x ^ $L[$i]) - 1 >> 8;
    } while ($i !== 0);
    return $c === 0;
  }

  /**
   * @param string $R
   * @return bool
   * @throws SodiumException
   * @throws TypeError
   */
  public static function small_order($R) {

    /** @var array<int, array<int, int>> $blacklist */
    $blacklist = array(
      /* 0 (order 4) */
      array(
        0x0,
        0x0,
        0x0,
        0x0,
        0x0,
        0x0,
        0x0,
        0x0,
        0x0,
        0x0,
        0x0,
        0x0,
        0x0,
        0x0,
        0x0,
        0x0,
        0x0,
        0x0,
        0x0,
        0x0,
        0x0,
        0x0,
        0x0,
        0x0,
        0x0,
        0x0,
        0x0,
        0x0,
        0x0,
        0x0,
        0x0,
        0x0,
      ),
      /* 1 (order 1) */
      array(
        0x1,
        0x0,
        0x0,
        0x0,
        0x0,
        0x0,
        0x0,
        0x0,
        0x0,
        0x0,
        0x0,
        0x0,
        0x0,
        0x0,
        0x0,
        0x0,
        0x0,
        0x0,
        0x0,
        0x0,
        0x0,
        0x0,
        0x0,
        0x0,
        0x0,
        0x0,
        0x0,
        0x0,
        0x0,
        0x0,
        0x0,
        0x0,
      ),
      /* 2707385501144840649318225287225658788936804267575313519463743609750303402022 (order 8) */
      array(
        0x26,
        0xe8,
        0x95,
        0x8f,
        0xc2,
        0xb2,
        0x27,
        0xb0,
        0x45,
        0xc3,
        0xf4,
        0x89,
        0xf2,
        0xef,
        0x98,
        0xf0,
        0xd5,
        0xdf,
        0xac,
        0x5,
        0xd3,
        0xc6,
        0x33,
        0x39,
        0xb1,
        0x38,
        0x2,
        0x88,
        0x6d,
        0x53,
        0xfc,
        0x5,
      ),
      /* 55188659117513257062467267217118295137698188065244968500265048394206261417927 (order 8) */
      array(
        0xc7,
        0x17,
        0x6a,
        0x70,
        0x3d,
        0x4d,
        0xd8,
        0x4f,
        0xba,
        0x3c,
        0xb,
        0x76,
        0xd,
        0x10,
        0x67,
        0xf,
        0x2a,
        0x20,
        0x53,
        0xfa,
        0x2c,
        0x39,
        0xcc,
        0xc6,
        0x4e,
        0xc7,
        0xfd,
        0x77,
        0x92,
        0xac,
        0x3,
        0x7a,
      ),
      /* p-1 (order 2) */
      array(
        0x13,
        0xe8,
        0x95,
        0x8f,
        0xc2,
        0xb2,
        0x27,
        0xb0,
        0x45,
        0xc3,
        0xf4,
        0x89,
        0xf2,
        0xef,
        0x98,
        0xf0,
        0xd5,
        0xdf,
        0xac,
        0x5,
        0xd3,
        0xc6,
        0x33,
        0x39,
        0xb1,
        0x38,
        0x2,
        0x88,
        0x6d,
        0x53,
        0xfc,
        0x85,
      ),
      /* p (order 4) */
      array(
        0xb4,
        0x17,
        0x6a,
        0x70,
        0x3d,
        0x4d,
        0xd8,
        0x4f,
        0xba,
        0x3c,
        0xb,
        0x76,
        0xd,
        0x10,
        0x67,
        0xf,
        0x2a,
        0x20,
        0x53,
        0xfa,
        0x2c,
        0x39,
        0xcc,
        0xc6,
        0x4e,
        0xc7,
        0xfd,
        0x77,
        0x92,
        0xac,
        0x3,
        0xfa,
      ),
      /* p+1 (order 1) */
      array(
        0xec,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0x7f,
      ),
      /* p+2707385501144840649318225287225658788936804267575313519463743609750303402022 (order 8) */
      array(
        0xed,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0x7f,
      ),
      /* p+55188659117513257062467267217118295137698188065244968500265048394206261417927 (order 8) */
      array(
        0xee,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0x7f,
      ),
      /* 2p-1 (order 2) */
      array(
        0xd9,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
      ),
      /* 2p (order 4) */
      array(
        0xda,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
      ),
      /* 2p+1 (order 1) */
      array(
        0xdb,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
        0xff,
      ),
    );

    /** @var int $countBlacklist */
    $countBlacklist = count($blacklist);
    for ($i = 0; $i < $countBlacklist; ++$i) {
      $c = 0;
      for ($j = 0; $j < 32; ++$j) {
        $c |= self::chrToInt($R[$j]) ^ (int) $blacklist[$i][$j];
      }
      if ($c === 0) {
        return true;
      }
    }
    return false;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ParagonIE_Sodium_Core_Curve25519::cmov public static function Conditional move
ParagonIE_Sodium_Core_Curve25519::equal public static function @internal You should not use this directly from another application
ParagonIE_Sodium_Core_Curve25519::fe_0 public static function Get a field element of size 10 with a value of 0
ParagonIE_Sodium_Core_Curve25519::fe_1 public static function Get a field element of size 10 with a value of 1
ParagonIE_Sodium_Core_Curve25519::fe_add public static function Add two field elements.
ParagonIE_Sodium_Core_Curve25519::fe_cmov public static function Constant-time conditional move.
ParagonIE_Sodium_Core_Curve25519::fe_copy public static function Create a copy of a field element.
ParagonIE_Sodium_Core_Curve25519::fe_frombytes public static function Give: 32-byte string. Receive: A field element object to use for internal calculations.
ParagonIE_Sodium_Core_Curve25519::fe_invert public static function @internal You should not use this directly from another application
ParagonIE_Sodium_Core_Curve25519::fe_isnegative public static function Is a field element negative? (1 = yes, 0 = no. Used in calculations.)
ParagonIE_Sodium_Core_Curve25519::fe_isnonzero public static function Returns 0 if this field element results in all NUL bytes.
ParagonIE_Sodium_Core_Curve25519::fe_mul public static function Multiply two field elements
ParagonIE_Sodium_Core_Curve25519::fe_neg public static function Get the negative values for each piece of the field element.
ParagonIE_Sodium_Core_Curve25519::fe_pow22523 public static function @internal You should not use this directly from another application
ParagonIE_Sodium_Core_Curve25519::fe_sq public static function Square a field element
ParagonIE_Sodium_Core_Curve25519::fe_sq2 public static function Square and double a field element
ParagonIE_Sodium_Core_Curve25519::fe_sub public static function Subtract two field elements.
ParagonIE_Sodium_Core_Curve25519::fe_tobytes public static function Convert a field element to a byte string.
ParagonIE_Sodium_Core_Curve25519::ge_add public static function Add two group elements.
ParagonIE_Sodium_Core_Curve25519::ge_double_scalarmult_vartime public static function @internal You should not use this directly from another application
ParagonIE_Sodium_Core_Curve25519::ge_frombytes_negate_vartime public static function @internal You should not use this directly from another application
ParagonIE_Sodium_Core_Curve25519::ge_madd public static function @internal You should not use this directly from another application
ParagonIE_Sodium_Core_Curve25519::ge_msub public static function @internal You should not use this directly from another application
ParagonIE_Sodium_Core_Curve25519::ge_mul_l public static function multiply by the order of the main subgroup l = 2^252+27742317777372353535851937790883648493
ParagonIE_Sodium_Core_Curve25519::ge_p1p1_to_p2 public static function @internal You should not use this directly from another application
ParagonIE_Sodium_Core_Curve25519::ge_p1p1_to_p3 public static function @internal You should not use this directly from another application
ParagonIE_Sodium_Core_Curve25519::ge_p2_0 public static function @internal You should not use this directly from another application
ParagonIE_Sodium_Core_Curve25519::ge_p2_dbl public static function @internal You should not use this directly from another application
ParagonIE_Sodium_Core_Curve25519::ge_p3_0 public static function @internal You should not use this directly from another application
ParagonIE_Sodium_Core_Curve25519::ge_p3_dbl public static function @internal You should not use this directly from another application
ParagonIE_Sodium_Core_Curve25519::ge_p3_tobytes public static function @internal You should not use this directly from another application
ParagonIE_Sodium_Core_Curve25519::ge_p3_to_cached public static function @internal You should not use this directly from another application
ParagonIE_Sodium_Core_Curve25519::ge_p3_to_p2 public static function @internal You should not use this directly from another application
ParagonIE_Sodium_Core_Curve25519::ge_precomp_0 public static function
ParagonIE_Sodium_Core_Curve25519::ge_scalarmult_base public static function @internal You should not use this directly from another application
ParagonIE_Sodium_Core_Curve25519::ge_select public static function @internal You should not use this directly from another application
ParagonIE_Sodium_Core_Curve25519::ge_sub public static function Subtract two group elements.
ParagonIE_Sodium_Core_Curve25519::ge_tobytes public static function Convert a group element to a byte string.
ParagonIE_Sodium_Core_Curve25519::negative public static function @internal You should not use this directly from another application
ParagonIE_Sodium_Core_Curve25519::sc_muladd public static function Calculates (ab + c) mod l where l = 2^252 + 27742317777372353535851937790883648493
ParagonIE_Sodium_Core_Curve25519::sc_reduce public static function @internal You should not use this directly from another application
ParagonIE_Sodium_Core_Curve25519::slide public static function @internal You should not use this directly from another application
ParagonIE_Sodium_Core_Curve25519_H::$base protected static property See: libsodium's crypto_core/curve25519/ref10/base.h
ParagonIE_Sodium_Core_Curve25519_H::$base2 protected static property See: libsodium's crypto_core/curve25519/ref10/base2.h
ParagonIE_Sodium_Core_Curve25519_H::$d protected static property 37095705934669439343138083508754565189542113879843219016388785533085940283555
ParagonIE_Sodium_Core_Curve25519_H::$d2 protected static property 2 * d = 16295367250680780974490674513165176452449235426866156013048779062215315747161
ParagonIE_Sodium_Core_Curve25519_H::$sqrtm1 protected static property sqrt(-1)
ParagonIE_Sodium_Core_Ed25519::check_S_lt_L public static function @internal You should not use this directly from another application
ParagonIE_Sodium_Core_Ed25519::keypair public static function @internal You should not use this directly from another application
ParagonIE_Sodium_Core_Ed25519::KEYPAIR_BYTES constant
ParagonIE_Sodium_Core_Ed25519::pk_to_curve25519 public static function
ParagonIE_Sodium_Core_Ed25519::publickey public static function @internal You should not use this directly from another application
ParagonIE_Sodium_Core_Ed25519::publickey_from_secretkey public static function @internal You should not use this directly from another application
ParagonIE_Sodium_Core_Ed25519::secretkey public static function @internal You should not use this directly from another application
ParagonIE_Sodium_Core_Ed25519::SEED_BYTES constant
ParagonIE_Sodium_Core_Ed25519::seed_keypair public static function @internal You should not use this directly from another application
ParagonIE_Sodium_Core_Ed25519::sign public static function @internal You should not use this directly from another application
ParagonIE_Sodium_Core_Ed25519::sign_detached public static function @internal You should not use this directly from another application
ParagonIE_Sodium_Core_Ed25519::sign_open public static function @internal You should not use this directly from another application
ParagonIE_Sodium_Core_Ed25519::sk_to_pk public static function @internal You should not use this directly from another application
ParagonIE_Sodium_Core_Ed25519::small_order public static function
ParagonIE_Sodium_Core_Ed25519::verify_detached public static function @internal You should not use this directly from another application
ParagonIE_Sodium_Core_Util::abs public static function
ParagonIE_Sodium_Core_Util::bin2hex public static function Convert a binary string into a hexadecimal string without cache-timing leaks
ParagonIE_Sodium_Core_Util::bin2hexUpper public static function Convert a binary string into a hexadecimal string without cache-timing leaks, returning uppercase letters (as per RFC 4648)
ParagonIE_Sodium_Core_Util::chrToInt public static function Cache-timing-safe variant of ord()
ParagonIE_Sodium_Core_Util::compare public static function Compares two strings.
ParagonIE_Sodium_Core_Util::declareScalarType public static function If a variable does not match a given type, throw a TypeError.
ParagonIE_Sodium_Core_Util::hashEquals public static function Evaluate whether or not two strings are equal (in constant-time)
ParagonIE_Sodium_Core_Util::hex2bin public static function Convert a hexadecimal string into a binary string without cache-timing leaks
ParagonIE_Sodium_Core_Util::intArrayToString public static function Turn an array of integers into a string
ParagonIE_Sodium_Core_Util::intToChr public static function Cache-timing-safe variant of ord()
ParagonIE_Sodium_Core_Util::isMbStringOverride protected static function Returns whether or not mbstring.func_overload is in effect.
ParagonIE_Sodium_Core_Util::load64_le public static function Load a 8 character substring into an integer
ParagonIE_Sodium_Core_Util::load_3 public static function Load a 3 character substring into an integer
ParagonIE_Sodium_Core_Util::load_4 public static function Load a 4 character substring into an integer
ParagonIE_Sodium_Core_Util::memcmp public static function @internal You should not use this directly from another application
ParagonIE_Sodium_Core_Util::mul public static function Multiply two integers in constant-time
ParagonIE_Sodium_Core_Util::numericTo64BitInteger public static function Convert any arbitrary numbers into two 32-bit integers that represent a 64-bit integer.
ParagonIE_Sodium_Core_Util::store32_le public static function Store a 32-bit integer into a string, treating it as little-endian.
ParagonIE_Sodium_Core_Util::store64_le public static function Stores a 64-bit integer as an string, treating it as little-endian.
ParagonIE_Sodium_Core_Util::store_3 public static function Store a 24-bit integer into a string, treating it as big-endian.
ParagonIE_Sodium_Core_Util::store_4 public static function Store a 32-bit integer into a string, treating it as big-endian.
ParagonIE_Sodium_Core_Util::stringToIntArray public static function Turn a string into an array of integers
ParagonIE_Sodium_Core_Util::strlen public static function Safe string length
ParagonIE_Sodium_Core_Util::substr public static function Safe substring
ParagonIE_Sodium_Core_Util::verify_16 public static function Compare a 16-character byte string in constant time.
ParagonIE_Sodium_Core_Util::verify_32 public static function Compare a 32-character byte string in constant time.
ParagonIE_Sodium_Core_Util::xorStrings public static function Calculate $a ^ $b for two strings.