@@ -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); |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | |
| 87 | 87 | // Derive key from password with hash_pbkdf2 function. |
| 88 | 88 | // Append CIPHER to password beforehand so that cross-method decryptions will fail at checksum step |
| 89 | - $key = \hash_pbkdf2(static::CHKSUM, ($pass . static::CIPHER), $ivr, $cost, 0, true); |
|
| 89 | + $key = \hash_pbkdf2(static::CHKSUM, ($pass.static::CIPHER), $ivr, $cost, 0, true); |
|
| 90 | 90 | |
| 91 | 91 | // Encrypt the plaintext data |
| 92 | 92 | $msg = OpensslWrapper::encrypt($data, static::CIPHER, $key, $ivr); |
@@ -98,6 +98,6 @@ discard block |
||
| 98 | 98 | $chk = \hash_hmac(static::CHKSUM, $msg, $key, true); |
| 99 | 99 | |
| 100 | 100 | // Return iv + checksum + iterations + cyphertext |
| 101 | - return $ivr . $chk . $itr . $msg; |
|
| 101 | + return $ivr.$chk.$itr.$msg; |
|
| 102 | 102 | } |
| 103 | 103 | } |
@@ -67,7 +67,7 @@ |
||
| 67 | 67 | * |
| 68 | 68 | * @param int $cost |
| 69 | 69 | * @param string $salt |
| 70 | - * @param string $passw |
|
| 70 | + * @param string $pass |
|
| 71 | 71 | * @return string |
| 72 | 72 | */ |
| 73 | 73 | private static function costEncrypt(int $cost, string $salt, string $pass): string |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | $cost = self::costEncrypt($cost, $salt, $password); |
| 60 | 60 | |
| 61 | 61 | // Return the salt + cost + hmac as a single string |
| 62 | - return $salt . $cost . $hash; |
|
| 62 | + return $salt.$cost.$hash; |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | /** |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | $packed = pack('L*', $cost); |
| 77 | 77 | |
| 78 | 78 | // Encrypt the string with the Otp stream cipher |
| 79 | - return Otp::crypt($packed, ($pass . $salt), self::ALGO); |
|
| 79 | + return Otp::crypt($packed, ($pass.$salt), self::ALGO); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | /** |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | private static function costDecrypt(string $pack, string $salt, string $pass): int |
| 91 | 91 | { |
| 92 | 92 | // Decrypt the cost value stored in the 32bit int |
| 93 | - $cost = Otp::crypt($pack, ($pass . $salt), self::ALGO); |
|
| 93 | + $cost = Otp::crypt($pack, ($pass.$salt), self::ALGO); |
|
| 94 | 94 | |
| 95 | 95 | // Unpack the value back to an integer and return to caller |
| 96 | 96 | return unpack('L*', $cost)[1]; |