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/Core
File: XChaCha20.php
<?php
[0] Fix | Delete
[1] Fix | Delete
if (class_exists('ParagonIE_Sodium_Core_XChaCha20', false)) {
[2] Fix | Delete
return;
[3] Fix | Delete
}
[4] Fix | Delete
[5] Fix | Delete
/**
[6] Fix | Delete
* Class ParagonIE_Sodium_Core_XChaCha20
[7] Fix | Delete
*/
[8] Fix | Delete
class ParagonIE_Sodium_Core_XChaCha20 extends ParagonIE_Sodium_Core_HChaCha20
[9] Fix | Delete
{
[10] Fix | Delete
/**
[11] Fix | Delete
* @internal You should not use this directly from another application
[12] Fix | Delete
*
[13] Fix | Delete
* @param int $len
[14] Fix | Delete
* @param string $nonce
[15] Fix | Delete
* @param string $key
[16] Fix | Delete
* @return string
[17] Fix | Delete
* @throws SodiumException
[18] Fix | Delete
* @throws TypeError
[19] Fix | Delete
*/
[20] Fix | Delete
public static function stream($len = 64, $nonce = '', $key = '')
[21] Fix | Delete
{
[22] Fix | Delete
if (self::strlen($nonce) !== 24) {
[23] Fix | Delete
throw new SodiumException('Nonce must be 24 bytes long');
[24] Fix | Delete
}
[25] Fix | Delete
return self::encryptBytes(
[26] Fix | Delete
new ParagonIE_Sodium_Core_ChaCha20_Ctx(
[27] Fix | Delete
self::hChaCha20(
[28] Fix | Delete
self::substr($nonce, 0, 16),
[29] Fix | Delete
$key
[30] Fix | Delete
),
[31] Fix | Delete
self::substr($nonce, 16, 8)
[32] Fix | Delete
),
[33] Fix | Delete
str_repeat("\x00", $len)
[34] Fix | Delete
);
[35] Fix | Delete
}
[36] Fix | Delete
[37] Fix | Delete
/**
[38] Fix | Delete
* @internal You should not use this directly from another application
[39] Fix | Delete
*
[40] Fix | Delete
* @param int $len
[41] Fix | Delete
* @param string $nonce
[42] Fix | Delete
* @param string $key
[43] Fix | Delete
* @return string
[44] Fix | Delete
* @throws SodiumException
[45] Fix | Delete
* @throws TypeError
[46] Fix | Delete
*/
[47] Fix | Delete
public static function ietfStream($len = 64, $nonce = '', $key = '')
[48] Fix | Delete
{
[49] Fix | Delete
if (self::strlen($nonce) !== 24) {
[50] Fix | Delete
throw new SodiumException('Nonce must be 24 bytes long');
[51] Fix | Delete
}
[52] Fix | Delete
return self::encryptBytes(
[53] Fix | Delete
new ParagonIE_Sodium_Core_ChaCha20_IetfCtx(
[54] Fix | Delete
self::hChaCha20(
[55] Fix | Delete
self::substr($nonce, 0, 16),
[56] Fix | Delete
$key
[57] Fix | Delete
),
[58] Fix | Delete
"\x00\x00\x00\x00" . self::substr($nonce, 16, 8)
[59] Fix | Delete
),
[60] Fix | Delete
str_repeat("\x00", $len)
[61] Fix | Delete
);
[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 string $message
[68] Fix | Delete
* @param string $nonce
[69] Fix | Delete
* @param string $key
[70] Fix | Delete
* @param string $ic
[71] Fix | Delete
* @return string
[72] Fix | Delete
* @throws SodiumException
[73] Fix | Delete
* @throws TypeError
[74] Fix | Delete
*/
[75] Fix | Delete
public static function streamXorIc($message, $nonce = '', $key = '', $ic = '')
[76] Fix | Delete
{
[77] Fix | Delete
if (self::strlen($nonce) !== 24) {
[78] Fix | Delete
throw new SodiumException('Nonce must be 24 bytes long');
[79] Fix | Delete
}
[80] Fix | Delete
return self::encryptBytes(
[81] Fix | Delete
new ParagonIE_Sodium_Core_ChaCha20_Ctx(
[82] Fix | Delete
self::hChaCha20(self::substr($nonce, 0, 16), $key),
[83] Fix | Delete
self::substr($nonce, 16, 8),
[84] Fix | Delete
$ic
[85] Fix | Delete
),
[86] Fix | Delete
$message
[87] Fix | Delete
);
[88] Fix | Delete
}
[89] Fix | Delete
[90] Fix | Delete
/**
[91] Fix | Delete
* @internal You should not use this directly from another application
[92] Fix | Delete
*
[93] Fix | Delete
* @param string $message
[94] Fix | Delete
* @param string $nonce
[95] Fix | Delete
* @param string $key
[96] Fix | Delete
* @param string $ic
[97] Fix | Delete
* @return string
[98] Fix | Delete
* @throws SodiumException
[99] Fix | Delete
* @throws TypeError
[100] Fix | Delete
*/
[101] Fix | Delete
public static function ietfStreamXorIc($message, $nonce = '', $key = '', $ic = '')
[102] Fix | Delete
{
[103] Fix | Delete
if (self::strlen($nonce) !== 24) {
[104] Fix | Delete
throw new SodiumException('Nonce must be 24 bytes long');
[105] Fix | Delete
}
[106] Fix | Delete
return self::encryptBytes(
[107] Fix | Delete
new ParagonIE_Sodium_Core_ChaCha20_IetfCtx(
[108] Fix | Delete
self::hChaCha20(self::substr($nonce, 0, 16), $key),
[109] Fix | Delete
"\x00\x00\x00\x00" . self::substr($nonce, 16, 8),
[110] Fix | Delete
$ic
[111] Fix | Delete
),
[112] Fix | Delete
$message
[113] Fix | Delete
);
[114] Fix | Delete
}
[115] Fix | Delete
}
[116] Fix | Delete
[117] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function