Unverified Commit 292fe138 authored by P.I.E. Security Team's avatar P.I.E. Security Team Committed by GitHub
Browse files

Merge pull request #40 from TimWolla/performance

Improve performance of the hex encoder
No related merge requests found
Showing with 2 additions and 2 deletions
+2 -2
......@@ -45,7 +45,7 @@ abstract class Hex implements EncoderInterface
$len = Binary::safeStrlen($binString);
for ($i = 0; $i < $len; ++$i) {
/** @var array<int, int> $chunk */
$chunk = \unpack('C', Binary::safeSubstr($binString, $i, 1));
$chunk = \unpack('C', $binString[$i]);
$c = $chunk[1] & 0xf;
$b = $chunk[1] >> 4;
......@@ -73,7 +73,7 @@ abstract class Hex implements EncoderInterface
for ($i = 0; $i < $len; ++$i) {
/** @var array<int, int> $chunk */
$chunk = \unpack('C', Binary::safeSubstr($binString, $i, 2));
$chunk = \unpack('C', $binString[$i]);
$c = $chunk[1] & 0xf;
$b = $chunk[1] >> 4;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment