@@ -147,12 +147,12 @@ discard block |
||
| 147 | 147 | } |
| 148 | 148 | // compute AIV |
| 149 | 149 | $mli = pack("N", $len); |
| 150 | - $aiv = self::AIV_HI . $mli; |
|
| 150 | + $aiv = self::AIV_HI.$mli; |
|
| 151 | 151 | // if key length was less than 8 octets (padded key contains |
| 152 | 152 | // exactly 8 octets), let the ciphertext be: |
| 153 | 153 | // C[0] | C[1] = ENC(K, A | P[1]). |
| 154 | 154 | if ($len <= 8) { |
| 155 | - return $this->_encrypt($kek, $aiv . $key); |
|
| 155 | + return $this->_encrypt($kek, $aiv.$key); |
|
| 156 | 156 | } |
| 157 | 157 | // build plaintext blocks and apply normal wrapping with AIV as an |
| 158 | 158 | // initial value |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | // For i = 1 to n |
| 253 | 253 | for ($i = 1; $i <= $n; ++$i) { |
| 254 | 254 | // B = AES(K, A | R[i]) |
| 255 | - $B = $this->_encrypt($kek, $A . $R[$i]); |
|
| 255 | + $B = $this->_encrypt($kek, $A.$R[$i]); |
|
| 256 | 256 | // A = MSB(64, B) ^ t where t = (n*j)+i |
| 257 | 257 | $t = $n * $j + $i; |
| 258 | 258 | $A = $this->_msb64($B) ^ $this->_uint64($t); |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | // if key consists of only one block, recover AIV and padded key as: |
| 285 | 285 | // A | P[1] = DEC(K, C[0] | C[1]) |
| 286 | 286 | if ($n == 1) { |
| 287 | - $P = str_split($this->_decrypt($kek, $C[0] . $C[1]), 8); |
|
| 287 | + $P = str_split($this->_decrypt($kek, $C[0].$C[1]), 8); |
|
| 288 | 288 | $A = $P[0]; |
| 289 | 289 | unset($P[0]); |
| 290 | 290 | } else { |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | for ($i = $n; $i >= 1; --$i) { |
| 328 | 328 | // B = AES-1(K, (A ^ t) | R[i]) where t = n*j+i |
| 329 | 329 | $t = $n * $j + $i; |
| 330 | - $B = $this->_decrypt($kek, ($A ^ $this->_uint64($t)) . $R[$i]); |
|
| 330 | + $B = $this->_decrypt($kek, ($A ^ $this->_uint64($t)).$R[$i]); |
|
| 331 | 331 | // A = MSB(64, B) |
| 332 | 332 | $A = $this->_msb64($B); |
| 333 | 333 | // R[i] = LSB(64, B) |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING); |
| 351 | 351 | if (false === $str) { |
| 352 | 352 | throw new \RuntimeException( |
| 353 | - "openssl_encrypt() failed: " . $this->_getLastOpenSSLError()); |
|
| 353 | + "openssl_encrypt() failed: ".$this->_getLastOpenSSLError()); |
|
| 354 | 354 | } |
| 355 | 355 | return $str; |
| 356 | 356 | } |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING); |
| 369 | 369 | if (false === $str) { |
| 370 | 370 | throw new \RuntimeException( |
| 371 | - "openssl_decrypt() failed: " . $this->_getLastOpenSSLError()); |
|
| 371 | + "openssl_decrypt() failed: ".$this->_getLastOpenSSLError()); |
|
| 372 | 372 | } |
| 373 | 373 | return $str; |
| 374 | 374 | } |
@@ -416,7 +416,7 @@ discard block |
||
| 416 | 416 | protected function _uint64($num) { |
| 417 | 417 | // truncate on 32 bit hosts |
| 418 | 418 | if (PHP_INT_SIZE < 8) { |
| 419 | - return "\0\0\0\0" . pack("N", $num); |
|
| 419 | + return "\0\0\0\0".pack("N", $num); |
|
| 420 | 420 | } |
| 421 | 421 | return pack("J", $num); |
| 422 | 422 | } |