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/clone/wp-inclu.../sodium_c.../src/Core32/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_Core32_ChaCha20_Ctx
[7] Fix | Delete
*/
[8] Fix | Delete
class ParagonIE_Sodium_Core32_ChaCha20_Ctx extends ParagonIE_Sodium_Core32_Util implements ArrayAccess
[9] Fix | Delete
{
[10] Fix | Delete
/**
[11] Fix | Delete
* @var SplFixedArray internally, <int, ParagonIE_Sodium_Core32_Int32>
[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 SodiumException
[26] Fix | Delete
* @throws TypeError
[27] Fix | Delete
*/
[28] Fix | Delete
public function __construct($key = '', $iv = '', $counter = '')
[29] Fix | Delete
{
[30] Fix | Delete
if (self::strlen($key) !== 32) {
[31] Fix | Delete
throw new InvalidArgumentException('ChaCha20 expects a 256-bit key.');
[32] Fix | Delete
}
[33] Fix | Delete
if (self::strlen($iv) !== 8) {
[34] Fix | Delete
throw new InvalidArgumentException('ChaCha20 expects a 64-bit nonce.');
[35] Fix | Delete
}
[36] Fix | Delete
$this->container = new SplFixedArray(16);
[37] Fix | Delete
[38] Fix | Delete
/* "expand 32-byte k" as per ChaCha20 spec */
[39] Fix | Delete
$this->container[0] = new ParagonIE_Sodium_Core32_Int32(array(0x6170, 0x7865));
[40] Fix | Delete
$this->container[1] = new ParagonIE_Sodium_Core32_Int32(array(0x3320, 0x646e));
[41] Fix | Delete
$this->container[2] = new ParagonIE_Sodium_Core32_Int32(array(0x7962, 0x2d32));
[42] Fix | Delete
$this->container[3] = new ParagonIE_Sodium_Core32_Int32(array(0x6b20, 0x6574));
[43] Fix | Delete
[44] Fix | Delete
$this->container[4] = ParagonIE_Sodium_Core32_Int32::fromReverseString(self::substr($key, 0, 4));
[45] Fix | Delete
$this->container[5] = ParagonIE_Sodium_Core32_Int32::fromReverseString(self::substr($key, 4, 4));
[46] Fix | Delete
$this->container[6] = ParagonIE_Sodium_Core32_Int32::fromReverseString(self::substr($key, 8, 4));
[47] Fix | Delete
$this->container[7] = ParagonIE_Sodium_Core32_Int32::fromReverseString(self::substr($key, 12, 4));
[48] Fix | Delete
$this->container[8] = ParagonIE_Sodium_Core32_Int32::fromReverseString(self::substr($key, 16, 4));
[49] Fix | Delete
$this->container[9] = ParagonIE_Sodium_Core32_Int32::fromReverseString(self::substr($key, 20, 4));
[50] Fix | Delete
$this->container[10] = ParagonIE_Sodium_Core32_Int32::fromReverseString(self::substr($key, 24, 4));
[51] Fix | Delete
$this->container[11] = ParagonIE_Sodium_Core32_Int32::fromReverseString(self::substr($key, 28, 4));
[52] Fix | Delete
[53] Fix | Delete
if (empty($counter)) {
[54] Fix | Delete
$this->container[12] = new ParagonIE_Sodium_Core32_Int32();
[55] Fix | Delete
$this->container[13] = new ParagonIE_Sodium_Core32_Int32();
[56] Fix | Delete
} else {
[57] Fix | Delete
$this->container[12] = ParagonIE_Sodium_Core32_Int32::fromReverseString(self::substr($counter, 0, 4));
[58] Fix | Delete
$this->container[13] = ParagonIE_Sodium_Core32_Int32::fromReverseString(self::substr($counter, 4, 4));
[59] Fix | Delete
}
[60] Fix | Delete
$this->container[14] = ParagonIE_Sodium_Core32_Int32::fromReverseString(self::substr($iv, 0, 4));
[61] Fix | Delete
$this->container[15] = ParagonIE_Sodium_Core32_Int32::fromReverseString(self::substr($iv, 4, 4));
[62] Fix | Delete
}
[63] Fix | Delete
[64] Fix | Delete
/**
[65] Fix | Delete
* @internal You should not use this directly from another application
[66] Fix | Delete
*
[67] Fix | Delete
* @param int $offset
[68] Fix | Delete
* @param int|ParagonIE_Sodium_Core32_Int32 $value
[69] Fix | Delete
* @return void
[70] Fix | Delete
*/
[71] Fix | Delete
#[ReturnTypeWillChange]
[72] Fix | Delete
public function offsetSet($offset, $value)
[73] Fix | Delete
{
[74] Fix | Delete
if (!is_int($offset)) {
[75] Fix | Delete
throw new InvalidArgumentException('Expected an integer');
[76] Fix | Delete
}
[77] Fix | Delete
if ($value instanceof ParagonIE_Sodium_Core32_Int32) {
[78] Fix | Delete
/*
[79] Fix | Delete
} elseif (is_int($value)) {
[80] Fix | Delete
$value = ParagonIE_Sodium_Core32_Int32::fromInt($value);
[81] Fix | Delete
*/
[82] Fix | Delete
} else {
[83] Fix | Delete
throw new InvalidArgumentException('Expected an integer');
[84] Fix | Delete
}
[85] Fix | Delete
$this->container[$offset] = $value;
[86] Fix | Delete
}
[87] Fix | Delete
[88] Fix | Delete
/**
[89] Fix | Delete
* @internal You should not use this directly from another application
[90] Fix | Delete
*
[91] Fix | Delete
* @param int $offset
[92] Fix | Delete
* @return bool
[93] Fix | Delete
* @psalm-suppress MixedArrayOffset
[94] Fix | Delete
*/
[95] Fix | Delete
#[ReturnTypeWillChange]
[96] Fix | Delete
public function offsetExists($offset)
[97] Fix | Delete
{
[98] Fix | Delete
return isset($this->container[$offset]);
[99] Fix | Delete
}
[100] Fix | Delete
[101] Fix | Delete
/**
[102] Fix | Delete
* @internal You should not use this directly from another application
[103] Fix | Delete
*
[104] Fix | Delete
* @param int $offset
[105] Fix | Delete
* @return void
[106] Fix | Delete
* @psalm-suppress MixedArrayOffset
[107] Fix | Delete
*/
[108] Fix | Delete
#[ReturnTypeWillChange]
[109] Fix | Delete
public function offsetUnset($offset)
[110] Fix | Delete
{
[111] Fix | Delete
unset($this->container[$offset]);
[112] Fix | Delete
}
[113] Fix | Delete
[114] Fix | Delete
/**
[115] Fix | Delete
* @internal You should not use this directly from another application
[116] Fix | Delete
*
[117] Fix | Delete
* @param int $offset
[118] Fix | Delete
* @return mixed|null
[119] Fix | Delete
* @psalm-suppress MixedArrayOffset
[120] Fix | Delete
*/
[121] Fix | Delete
#[ReturnTypeWillChange]
[122] Fix | Delete
public function offsetGet($offset)
[123] Fix | Delete
{
[124] Fix | Delete
return isset($this->container[$offset])
[125] Fix | Delete
? $this->container[$offset]
[126] Fix | Delete
: null;
[127] Fix | Delete
}
[128] Fix | Delete
}
[129] Fix | Delete
[130] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function