1
0
mirror of https://github.com/danog/phpseclib.git synced 2024-12-04 18:48:24 +01:00

Salsa20: fix PHP 5.6 error

The following demonstrates the error:

function demo(&$x)
{
  $x = 5;
}

$x = $y = [10];
demo(...$y);
echo $x[0];

That outputs 5 in PHP 5.6 and 10 in later PHP versions
This commit is contained in:
terrafrost 2021-12-10 07:30:26 -06:00
parent 072a56b2f9
commit 8a0e6c05e7

View File

@ -480,7 +480,7 @@ class Salsa20 extends StreamCipher
{
$z = $x = unpack('V*', $x);
for ($i = 0; $i < 10; $i++) {
static::doubleRound(...$z);
static::doubleRound($z[1], $z[2], $z[3], $z[4], $z[5], $z[6], $z[7], $z[8], $z[9], $z[10], $z[11], $z[12], $z[13], $z[14], $z[15], $z[16]);
}
for ($i = 1; $i <= 16; $i++) {