You are here

class ParagonIE_Sodium_Core_ChaCha20_IetfCtx in Automatic Updates 7

Same name and namespace in other branches
  1. 8 vendor/paragonie/sodium_compat/src/Core/ChaCha20/IetfCtx.php \ParagonIE_Sodium_Core_ChaCha20_IetfCtx

Class ParagonIE_Sodium_Core_ChaCha20_IetfCtx

Hierarchy

Expanded class hierarchy of ParagonIE_Sodium_Core_ChaCha20_IetfCtx

2 string references to 'ParagonIE_Sodium_Core_ChaCha20_IetfCtx'
IetfCtx.php in vendor/paragonie/sodium_compat/src/Core/ChaCha20/IetfCtx.php
IetfCtx.php in vendor/paragonie/sodium_compat/src/Core32/ChaCha20/IetfCtx.php

File

vendor/paragonie/sodium_compat/src/Core/ChaCha20/IetfCtx.php, line 10

View source
class ParagonIE_Sodium_Core_ChaCha20_IetfCtx extends ParagonIE_Sodium_Core_ChaCha20_Ctx {

  /**
   * ParagonIE_Sodium_Core_ChaCha20_IetfCtx constructor.
   *
   * @internal You should not use this directly from another application
   *
   * @param string $key     ChaCha20 key.
   * @param string $iv      Initialization Vector (a.k.a. nonce).
   * @param string $counter The initial counter value.
   *                        Defaults to 4 0x00 bytes.
   * @throws InvalidArgumentException
   * @throws TypeError
   */
  public function __construct($key = '', $iv = '', $counter = '') {
    if (self::strlen($iv) !== 12) {
      throw new InvalidArgumentException('ChaCha20 expects a 96-bit nonce in IETF mode.');
    }
    parent::__construct($key, self::substr($iv, 0, 8), $counter);
    if (!empty($counter)) {
      $this->container[12] = self::load_4(self::substr($counter, 0, 4));
    }
    $this->container[13] = self::load_4(self::substr($iv, 0, 4));
    $this->container[14] = self::load_4(self::substr($iv, 4, 4));
    $this->container[15] = self::load_4(self::substr($iv, 8, 4));
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ParagonIE_Sodium_Core_ChaCha20_Ctx::$container protected property
ParagonIE_Sodium_Core_ChaCha20_Ctx::offsetExists public function @internal You should not use this directly from another application
ParagonIE_Sodium_Core_ChaCha20_Ctx::offsetGet public function @internal You should not use this directly from another application
ParagonIE_Sodium_Core_ChaCha20_Ctx::offsetSet public function @internal You should not use this directly from another application
ParagonIE_Sodium_Core_ChaCha20_Ctx::offsetUnset public function @internal You should not use this directly from another application
ParagonIE_Sodium_Core_ChaCha20_IetfCtx::__construct public function ParagonIE_Sodium_Core_ChaCha20_IetfCtx constructor. Overrides ParagonIE_Sodium_Core_ChaCha20_Ctx::__construct
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.