@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types = 1); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * Pkcs7.php |
@@ -41,7 +41,7 @@ discard block |
||
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 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types = 1); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * Hash.php |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $chsh = self::costHash($cost, $pass); |
70 | 70 | |
71 | 71 | // Return the salt + cost + hmac as a single string |
72 | - return $salt . $chsh . $cost . $hash; |
|
72 | + return $salt.$chsh.$cost.$hash; |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | $packed = pack('N', $cost); |
87 | 87 | |
88 | 88 | // Encrypt the string with the Otp stream cipher |
89 | - return Otp::crypt($packed, ($pass . $salt), self::ALGO); |
|
89 | + return Otp::crypt($packed, ($pass.$salt), self::ALGO); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | private static function costDecrypt(string $pack, string $salt, string $pass): int |
101 | 101 | { |
102 | 102 | // Decrypt the cost value stored in the 32bit int |
103 | - $pack = Otp::crypt($pack, ($pass . $salt), self::ALGO); |
|
103 | + $pack = Otp::crypt($pack, ($pass.$salt), self::ALGO); |
|
104 | 104 | |
105 | 105 | // Unpack the value back to an integer and return to caller |
106 | 106 | return unpack('N', $pack)[1]; |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types = 1); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * OpensslWrapper.php |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types = 1); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * OpensslBridge.php |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types = 1); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * Str.php |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | // We hash the 2 inputs at this point because hash_equals is still |
51 | 51 | // vulnerable to timing attacks when the inputs have different sizes. |
52 | 52 | // Inputs are also cast to string like in symfony stringutils. |
53 | - $known = \hash_hmac('sha256', (string)$known, $nonce, true); |
|
54 | - $given = \hash_hmac('sha256', (string)$given, $nonce, true); |
|
53 | + $known = \hash_hmac('sha256', (string) $known, $nonce, true); |
|
54 | + $given = \hash_hmac('sha256', (string) $given, $nonce, true); |
|
55 | 55 | |
56 | 56 | return \hash_equals($known, $given); |
57 | 57 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types = 1); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * Otp.php |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $length = Str::strlen($input); |
45 | 45 | |
46 | 46 | foreach ($chunks as $i => &$chunk) { |
47 | - $chunk = $chunk ^ \hash_hmac($algo, $password . $length, $i, true); |
|
47 | + $chunk = $chunk ^ \hash_hmac($algo, $password.$length, $i, true); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | return \implode($chunks); |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types = 1); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * AesOfb.php |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types = 1); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * OpensslStatic.php |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | $msg = Str::substr($data, $isz + $hsz + $tsz + 4); |
47 | 47 | |
48 | 48 | // Calculate verification checksum |
49 | - $chk = \hash_hmac($algo, ($msg . $itr . $ivr), $pass, true); |
|
49 | + $chk = \hash_hmac($algo, ($msg.$itr.$ivr), $pass, true); |
|
50 | 50 | |
51 | 51 | // Verify HMAC before decrypting |
52 | 52 | if (!Str::equal($chk, $sum)) { |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | $cost = \unpack('N', $itr ^ \hash_hmac($algo, $ivr, $pass, true))[1]; |
58 | 58 | |
59 | 59 | // Derive key from password |
60 | - $key = \hash_pbkdf2($algo, ($pass . $cipher), $ivr, $cost, 0, true); |
|
60 | + $key = \hash_pbkdf2($algo, ($pass.$cipher), $ivr, $cost, 0, true); |
|
61 | 61 | |
62 | 62 | // Decrypt message and return |
63 | 63 | return parent::openssl_decrypt($msg, $cipher, $key, $ivr, $tag); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | |
71 | 71 | // Derive key from password with hash_pbkdf2 function. |
72 | 72 | // Append CIPHER to password beforehand so that cross-method decryptions will fail at checksum step |
73 | - $key = \hash_pbkdf2($algo, ($pass . $cipher), $ivr, $cost, 0, true); |
|
73 | + $key = \hash_pbkdf2($algo, ($pass.$cipher), $ivr, $cost, 0, true); |
|
74 | 74 | |
75 | 75 | // Create a placeholder for the authentication tag to be passed by reference |
76 | 76 | $tag = ''; |
@@ -82,9 +82,9 @@ discard block |
||
82 | 82 | $itr = \pack('N', $cost) ^ \hash_hmac($algo, $ivr, $pass, true); |
83 | 83 | |
84 | 84 | // Generate the ciphertext checksum to prevent bit tampering |
85 | - $chk = \hash_hmac($algo, ($msg . $itr . $ivr), $pass, true); |
|
85 | + $chk = \hash_hmac($algo, ($msg.$itr.$ivr), $pass, true); |
|
86 | 86 | |
87 | 87 | // Return iv + checksum + iterations + cyphertext + tag |
88 | - return $ivr . $chk . $tag . $itr . $msg; |
|
88 | + return $ivr.$chk.$tag.$itr.$msg; |
|
89 | 89 | } |
90 | 90 | } |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types = 1); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * Rc4.php |