@@ -36,7 +36,7 @@ |
||
| 36 | 36 | ); |
| 37 | 37 | |
| 38 | 38 | foreach ($files as $f) { |
| 39 | - require_once __DIR__ . "/src/$f.php"; |
|
| 39 | + require_once __DIR__."/src/$f.php"; |
|
| 40 | 40 | } |
| 41 | 41 | } |
| 42 | 42 | // @codeCoverageIgnoreEnd |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | $pad = self::paddingString(Str::strlen($input), $blocksize); |
| 42 | 42 | |
| 43 | 43 | // Return input + padding |
| 44 | - return $input . $pad; |
|
| 44 | + return $input.$pad; |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | /** |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -require __DIR__ . '/vendor/autoload.php'; |
|
| 3 | +require __DIR__.'/vendor/autoload.php'; |
|
| 4 | 4 | |
| 5 | 5 | // backward compatibility |
| 6 | 6 | if (!class_exists('\PHPUnit\Framework\TestCase')) { |
@@ -53,7 +53,7 @@ |
||
| 53 | 53 | $length = Str::strlen($input); |
| 54 | 54 | |
| 55 | 55 | foreach ($chunks as $i => &$chunk) { |
| 56 | - $chunk = $chunk ^ \hash_hmac($algo, $password . $length, $i, true); |
|
| 56 | + $chunk = $chunk ^ \hash_hmac($algo, $password.$length, $i, true); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | return \implode($chunks); |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | $hash = self::ihmac($input, $key, $cost, self::ALGO); |
| 61 | 61 | |
| 62 | 62 | // Return the salt + cost blob + hmac |
| 63 | - return $salt . self::costHash($cost, $salt, $password) . $hash; |
|
| 63 | + return $salt.self::costHash($cost, $salt, $password).$hash; |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | /** |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | // Convert cost to base 256 then encrypt with OTP stream cipher |
| 84 | 84 | $cost = Otp::crypt(self::dec2bin($cost), $password); |
| 85 | 85 | |
| 86 | - return $hash . $cost; |
|
| 86 | + return $hash.$cost; |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | /** |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | // Perform iterative hmac calls |
| 105 | 105 | // Make sure $iter value of 0 is handled |
| 106 | 106 | for ($i = 0; $i <= $iter; $i++) { |
| 107 | - $data = self::hmac($data . $i . $iter, $key, $algo); |
|
| 107 | + $data = self::hmac($data.$i.$iter, $key, $algo); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | return $data; |
@@ -70,9 +70,9 @@ |
||
| 70 | 70 | */ |
| 71 | 71 | private static function cost(int $cost): int |
| 72 | 72 | { |
| 73 | - if ($cost < 0 || $cost > \pow(2, 32)) { |
|
| 74 | - throw new \InvalidArgumentException("Hashing cost parameter must between 0 and 2^32"); |
|
| 75 | - } |
|
| 73 | + if ($cost < 0 || $cost > \pow(2, 32)) { |
|
| 74 | + throw new \InvalidArgumentException("Hashing cost parameter must between 0 and 2^32"); |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | 77 | return $cost; |
| 78 | 78 | } |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | $cost = \unpack('L*', $itr ^ \hash_hmac(static::CHKSUM, $ivr, $pass, true))[1]; |
| 58 | 58 | |
| 59 | 59 | // Derive key from password |
| 60 | - $key = \hash_pbkdf2(static::CHKSUM, ($pass . static::CIPHER), $ivr, $cost, 0, true); |
|
| 60 | + $key = \hash_pbkdf2(static::CHKSUM, ($pass.static::CIPHER), $ivr, $cost, 0, true); |
|
| 61 | 61 | |
| 62 | 62 | // Calculate verification checksum |
| 63 | 63 | $chk = \hash_hmac(static::CHKSUM, $msg, $key, true); |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | $ivr = \random_bytes(OpensslWrapper::ivsize(static::CIPHER)); |
| 84 | 84 | |
| 85 | 85 | // Derive key from password |
| 86 | - $key = \hash_pbkdf2(static::CHKSUM, ($pass . static::CIPHER), $ivr, $cost, 0, true); |
|
| 86 | + $key = \hash_pbkdf2(static::CHKSUM, ($pass.static::CIPHER), $ivr, $cost, 0, true); |
|
| 87 | 87 | |
| 88 | 88 | // Encrypt the plaintext |
| 89 | 89 | $msg = OpensslWrapper::encrypt($data, static::CIPHER, $key, $ivr); |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | $chk = \hash_hmac(static::CHKSUM, $msg, $key, true); |
| 96 | 96 | |
| 97 | 97 | // Return iv + checksum + iterations + cyphertext |
| 98 | - return $ivr . $chk . $itr . $msg; |
|
| 98 | + return $ivr.$chk.$itr.$msg; |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |