@@ -146,12 +146,12 @@ discard block |
||
| 146 | 146 | } |
| 147 | 147 | // compute AIV |
| 148 | 148 | $mli = pack("N", $len); |
| 149 | - $aiv = self::AIV_HI . $mli; |
|
| 149 | + $aiv = self::AIV_HI.$mli; |
|
| 150 | 150 | // if key length was less than 8 octets (padded key contains |
| 151 | 151 | // exactly 8 octets), let the ciphertext be: |
| 152 | 152 | // C[0] | C[1] = ENC(K, A | P[1]). |
| 153 | 153 | if ($len <= 8) { |
| 154 | - return $this->_encrypt($kek, $aiv . $key); |
|
| 154 | + return $this->_encrypt($kek, $aiv.$key); |
|
| 155 | 155 | } |
| 156 | 156 | // build plaintext blocks and apply normal wrapping with AIV as an |
| 157 | 157 | // initial value |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | // if key consists of only one block, recover AIV and padded key as: |
| 188 | 188 | // A | P[1] = DEC(K, C[0] | C[1]) |
| 189 | 189 | if ($n == 1) { |
| 190 | - $P = str_split($this->_decrypt($kek, $C[0] . $C[1]), 8); |
|
| 190 | + $P = str_split($this->_decrypt($kek, $C[0].$C[1]), 8); |
|
| 191 | 191 | $A = $P[0]; |
| 192 | 192 | unset($P[0]); |
| 193 | 193 | } else { |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | // For i = 1 to n |
| 259 | 259 | for ($i = 1; $i <= $n; ++$i) { |
| 260 | 260 | // B = AES(K, A | R[i]) |
| 261 | - $B = $this->_encrypt($kek, $A . $R[$i]); |
|
| 261 | + $B = $this->_encrypt($kek, $A.$R[$i]); |
|
| 262 | 262 | // A = MSB(64, B) ^ t where t = (n*j)+i |
| 263 | 263 | $t = $n * $j + $i; |
| 264 | 264 | $A = $this->_msb64($B) ^ $this->_uint64($t); |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | for ($i = $n; $i >= 1; --$i) { |
| 307 | 307 | // B = AES-1(K, (A ^ t) | R[i]) where t = n*j+i |
| 308 | 308 | $t = $n * $j + $i; |
| 309 | - $B = $this->_decrypt($kek, ($A ^ $this->_uint64($t)) . $R[$i]); |
|
| 309 | + $B = $this->_decrypt($kek, ($A ^ $this->_uint64($t)).$R[$i]); |
|
| 310 | 310 | // A = MSB(64, B) |
| 311 | 311 | $A = $this->_msb64($B); |
| 312 | 312 | // R[i] = LSB(64, B) |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING); |
| 330 | 330 | if (false === $str) { |
| 331 | 331 | throw new \RuntimeException( |
| 332 | - "openssl_encrypt() failed: " . $this->_getLastOpenSSLError()); |
|
| 332 | + "openssl_encrypt() failed: ".$this->_getLastOpenSSLError()); |
|
| 333 | 333 | } |
| 334 | 334 | return $str; |
| 335 | 335 | } |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING); |
| 348 | 348 | if (false === $str) { |
| 349 | 349 | throw new \RuntimeException( |
| 350 | - "openssl_decrypt() failed: " . $this->_getLastOpenSSLError()); |
|
| 350 | + "openssl_decrypt() failed: ".$this->_getLastOpenSSLError()); |
|
| 351 | 351 | } |
| 352 | 352 | return $str; |
| 353 | 353 | } |
@@ -395,7 +395,7 @@ discard block |
||
| 395 | 395 | protected function _uint64($num) { |
| 396 | 396 | // truncate on 32 bit hosts |
| 397 | 397 | if (PHP_INT_SIZE < 8) { |
| 398 | - return "\0\0\0\0" . pack("N", $num); |
|
| 398 | + return "\0\0\0\0".pack("N", $num); |
|
| 399 | 399 | } |
| 400 | 400 | return pack("J", $num); |
| 401 | 401 | } |