Blowfish: CS adjustments (" -> ')

This commit is contained in:
terrafrost 2018-12-02 12:21:56 -06:00
parent 5bcb298af7
commit 9bcd851e97

View File

@ -411,14 +411,14 @@ class Blowfish extends BlockCipher
*/ */
protected function encryptBlock($in) protected function encryptBlock($in)
{ {
$p = $this->bctx["p"]; $p = $this->bctx['p'];
// extract($this->bctx["sb"], EXTR_PREFIX_ALL, "sb"); // slower // extract($this->bctx['sb'], EXTR_PREFIX_ALL, 'sb'); // slower
$sb_0 = $this->bctx["sb"][0]; $sb_0 = $this->bctx['sb'][0];
$sb_1 = $this->bctx["sb"][1]; $sb_1 = $this->bctx['sb'][1];
$sb_2 = $this->bctx["sb"][2]; $sb_2 = $this->bctx['sb'][2];
$sb_3 = $this->bctx["sb"][3]; $sb_3 = $this->bctx['sb'][3];
$in = unpack("N*", $in); $in = unpack('N*', $in);
$l = $in[1]; $l = $in[1];
$r = $in[2]; $r = $in[2];
@ -433,7 +433,7 @@ class Blowfish extends BlockCipher
$sb_2[$r >> 8 & 0xff]) + $sb_2[$r >> 8 & 0xff]) +
$sb_3[$r & 0xff]); $sb_3[$r & 0xff]);
} }
return pack("N*", $r ^ $p[17], $l ^ $p[16]); return pack('N*', $r ^ $p[17], $l ^ $p[16]);
} }
/** /**
@ -445,13 +445,13 @@ class Blowfish extends BlockCipher
*/ */
protected function decryptBlock($in) protected function decryptBlock($in)
{ {
$p = $this->bctx["p"]; $p = $this->bctx['p'];
$sb_0 = $this->bctx["sb"][0]; $sb_0 = $this->bctx['sb'][0];
$sb_1 = $this->bctx["sb"][1]; $sb_1 = $this->bctx['sb'][1];
$sb_2 = $this->bctx["sb"][2]; $sb_2 = $this->bctx['sb'][2];
$sb_3 = $this->bctx["sb"][3]; $sb_3 = $this->bctx['sb'][3];
$in = unpack("N*", $in); $in = unpack('N*', $in);
$l = $in[1]; $l = $in[1];
$r = $in[2]; $r = $in[2];
@ -466,7 +466,7 @@ class Blowfish extends BlockCipher
$sb_2[$r >> 8 & 0xff]) + $sb_2[$r >> 8 & 0xff]) +
$sb_3[$r & 0xff]); $sb_3[$r & 0xff]);
} }
return pack("N*", $r ^ $p[0], $l ^ $p[1]); return pack('N*', $r ^ $p[0], $l ^ $p[1]);
} }
/** /**