@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | // Append an "a" behind the password and hash it to prevent reusing the same password as for encryption |
| 77 | - $password = hash('sha512', $password . 'a'); |
|
| 77 | + $password = hash('sha512', $password.'a'); |
|
| 78 | 78 | |
| 79 | 79 | $hash = new Hash('sha512'); |
| 80 | 80 | $hash->setKey($password); |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | $this->cipher->setPassword($encryptionKey); |
| 153 | 153 | $this->cipher->setIV($iv); |
| 154 | 154 | |
| 155 | - if (!hash_equals($this->calculateHMAC($parts[0] . $parts[1], $hmacKey), $hmac)) { |
|
| 155 | + if (!hash_equals($this->calculateHMAC($parts[0].$parts[1], $hmacKey), $hmac)) { |
|
| 156 | 156 | throw new Exception('HMAC does not match.'); |
| 157 | 157 | } |
| 158 | 158 | |
@@ -166,15 +166,15 @@ discard block |
||
| 166 | 166 | |
| 167 | 167 | private function hex2bin(string $hex): string { |
| 168 | 168 | if (!ctype_xdigit($hex)) { |
| 169 | - throw new \RuntimeException('String contains non hex chars: ' . $hex); |
|
| 169 | + throw new \RuntimeException('String contains non hex chars: '.$hex); |
|
| 170 | 170 | } |
| 171 | 171 | if (strlen($hex) % 2 !== 0) { |
| 172 | - throw new \RuntimeException('Hex string is not of even length: ' . $hex); |
|
| 172 | + throw new \RuntimeException('Hex string is not of even length: '.$hex); |
|
| 173 | 173 | } |
| 174 | 174 | $result = hex2bin($hex); |
| 175 | 175 | |
| 176 | 176 | if ($result === false) { |
| 177 | - throw new \RuntimeException('Hex to bin conversion failed: ' . $hex); |
|
| 177 | + throw new \RuntimeException('Hex to bin conversion failed: '.$hex); |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | return $result; |