Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-inclu.../sodium_c.../src/Core/ChaCha20
File: Ctx.php
<?php
[0] Fix | Delete
[1] Fix | Delete
if (class_exists('ParagonIE_Sodium_Core_ChaCha20_Ctx', false)) {
[2] Fix | Delete
return;
[3] Fix | Delete
}
[4] Fix | Delete
[5] Fix | Delete
/**
[6] Fix | Delete
* Class ParagonIE_Sodium_Core_ChaCha20_Ctx
[7] Fix | Delete
*/
[8] Fix | Delete
class ParagonIE_Sodium_Core_ChaCha20_Ctx extends ParagonIE_Sodium_Core_Util implements ArrayAccess
[9] Fix | Delete
{
[10] Fix | Delete
/**
[11] Fix | Delete
* @var SplFixedArray internally, <int, int>
[12] Fix | Delete
*/
[13] Fix | Delete
protected $container;
[14] Fix | Delete
[15] Fix | Delete
/**
[16] Fix | Delete
* ParagonIE_Sodium_Core_ChaCha20_Ctx constructor.
[17] Fix | Delete
*
[18] Fix | Delete
* @internal You should not use this directly from another application
[19] Fix | Delete
*
[20] Fix | Delete
* @param string $key ChaCha20 key.
[21] Fix | Delete
* @param string $iv Initialization Vector (a.k.a. nonce).
[22] Fix | Delete
* @param string $counter The initial counter value.
[23] Fix | Delete
* Defaults to 8 0x00 bytes.
[24] Fix | Delete
* @throws InvalidArgumentException
[25] Fix | Delete
* @throws TypeError
[26] Fix | Delete
*/
[27] Fix | Delete
public function __construct($key = '', $iv = '', $counter = '')
[28] Fix | Delete
{
[29] Fix | Delete
if (self::strlen($key) !== 32) {
[30] Fix | Delete
throw new InvalidArgumentException('ChaCha20 expects a 256-bit key.');
[31] Fix | Delete
}
[32] Fix | Delete
if (self::strlen($iv) !== 8) {
[33] Fix | Delete
throw new InvalidArgumentException('ChaCha20 expects a 64-bit nonce.');
[34] Fix | Delete
}
[35] Fix | Delete
$this->container = new SplFixedArray(16);
[36] Fix | Delete
[37] Fix | Delete
/* "expand 32-byte k" as per ChaCha20 spec */
[38] Fix | Delete
$this->container[0] = 0x61707865;
[39] Fix | Delete
$this->container[1] = 0x3320646e;
[40] Fix | Delete
$this->container[2] = 0x79622d32;
[41] Fix | Delete
$this->container[3] = 0x6b206574;
[42] Fix | Delete
$this->container[4] = self::load_4(self::substr($key, 0, 4));
[43] Fix | Delete
$this->container[5] = self::load_4(self::substr($key, 4, 4));
[44] Fix | Delete
$this->container[6] = self::load_4(self::substr($key, 8, 4));
[45] Fix | Delete
$this->container[7] = self::load_4(self::substr($key, 12, 4));
[46] Fix | Delete
$this->container[8] = self::load_4(self::substr($key, 16, 4));
[47] Fix | Delete
$this->container[9] = self::load_4(self::substr($key, 20, 4));
[48] Fix | Delete
$this->container[10] = self::load_4(self::substr($key, 24, 4));
[49] Fix | Delete
$this->container[11] = self::load_4(self::substr($key, 28, 4));
[50] Fix | Delete
[51] Fix | Delete
if (empty($counter)) {
[52] Fix | Delete
$this->container[12] = 0;
[53] Fix | Delete
$this->container[13] = 0;
[54] Fix | Delete
} else {
[55] Fix | Delete
$this->container[12] = self::load_4(self::substr($counter, 0, 4));
[56] Fix | Delete
$this->container[13] = self::load_4(self::substr($counter, 4, 4));
[57] Fix | Delete
}
[58] Fix | Delete
$this->container[14] = self::load_4(self::substr($iv, 0, 4));
[59] Fix | Delete
$this->container[15] = self::load_4(self::substr($iv, 4, 4));
[60] Fix | Delete
}
[61] Fix | Delete
[62] Fix | Delete
/**
[63] Fix | Delete
* @internal You should not use this directly from another application
[64] Fix | Delete
*
[65] Fix | Delete
* @param int $offset
[66] Fix | Delete
* @param int $value
[67] Fix | Delete
* @return void
[68] Fix | Delete
* @psalm-suppress MixedArrayOffset
[69] Fix | Delete
*/
[70] Fix | Delete
#[ReturnTypeWillChange]
[71] Fix | Delete
public function offsetSet($offset, $value)
[72] Fix | Delete
{
[73] Fix | Delete
if (!is_int($offset)) {
[74] Fix | Delete
throw new InvalidArgumentException('Expected an integer');
[75] Fix | Delete
}
[76] Fix | Delete
if (!is_int($value)) {
[77] Fix | Delete
throw new InvalidArgumentException('Expected an integer');
[78] Fix | Delete
}
[79] Fix | Delete
$this->container[$offset] = $value;
[80] Fix | Delete
}
[81] Fix | Delete
[82] Fix | Delete
/**
[83] Fix | Delete
* @internal You should not use this directly from another application
[84] Fix | Delete
*
[85] Fix | Delete
* @param int $offset
[86] Fix | Delete
* @return bool
[87] Fix | Delete
*/
[88] Fix | Delete
#[ReturnTypeWillChange]
[89] Fix | Delete
public function offsetExists($offset)
[90] Fix | Delete
{
[91] Fix | Delete
return isset($this->container[$offset]);
[92] Fix | Delete
}
[93] Fix | Delete
[94] Fix | Delete
/**
[95] Fix | Delete
* @internal You should not use this directly from another application
[96] Fix | Delete
*
[97] Fix | Delete
* @param int $offset
[98] Fix | Delete
* @return void
[99] Fix | Delete
* @psalm-suppress MixedArrayOffset
[100] Fix | Delete
*/
[101] Fix | Delete
#[ReturnTypeWillChange]
[102] Fix | Delete
public function offsetUnset($offset)
[103] Fix | Delete
{
[104] Fix | Delete
unset($this->container[$offset]);
[105] Fix | Delete
}
[106] Fix | Delete
[107] Fix | Delete
/**
[108] Fix | Delete
* @internal You should not use this directly from another application
[109] Fix | Delete
*
[110] Fix | Delete
* @param int $offset
[111] Fix | Delete
* @return mixed|null
[112] Fix | Delete
* @psalm-suppress MixedArrayOffset
[113] Fix | Delete
*/
[114] Fix | Delete
#[ReturnTypeWillChange]
[115] Fix | Delete
public function offsetGet($offset)
[116] Fix | Delete
{
[117] Fix | Delete
return isset($this->container[$offset])
[118] Fix | Delete
? $this->container[$offset]
[119] Fix | Delete
: null;
[120] Fix | Delete
}
[121] Fix | Delete
}
[122] Fix | Delete
[123] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function