else { $src =
rtrim($src, '='
);
$srcLen = ParagonIE_Sodium_Core_Util::
strlen($src);
} $err = 0;
$dest = '';
// Main loop (no padding):
for ($i = 0;
$i + 4 <=
$srcLen;
$i += 4
) { /** @var array<int, int> $chunk */
$chunk =
unpack('C*', ParagonIE_Sodium_Core_Util::
substr($src,
$i, 4
));
$c0 = self::
decode6Bits($chunk[1
]);
$c1 = self::
decode6Bits($chunk[2
]);
$c2 = self::
decode6Bits($chunk[3
]);
$c3 = self::
decode6Bits($chunk[4
]);
$dest .=
pack( 'CCC',
((($c0 << 2
) |
($c1 >> 4
)) & 0xff
),
((($c1 << 4
) |
($c2 >> 2
)) & 0xff
),
((($c2 << 6
) |
$c3 ) & 0xff
) );
$err |= ($c0 |
$c1 |
$c2 |
$c3) >> 8;
}