Apply PSR-12 code style (#3886)
[GitHub/WoltLab/WCF.git] / wcfsetup / install / files / lib / system / user / authentication / password / algorithm / Joomla1.class.php
index e924b88de236d904958f8d9e69db016871424361..415ce26c91db2caec03c8755155c2cad299360ac 100644 (file)
@@ -1,47 +1,54 @@
 <?php
+
 namespace wcf\system\user\authentication\password\algorithm;
+
 use ParagonIE\ConstantTime\Hex;
 use wcf\system\user\authentication\password\IPasswordAlgorithm;
 
 /**
  * Implementation of the password algorithm for Joomla 1.x (kunea).
  *
- * @author     Joshua Ruesweg
- * @copyright  2001-2020 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package    WoltLabSuite\Core\System\User\Authentication\Password\Algorithm
- * @since      5.4
+ * @author  Joshua Ruesweg
+ * @copyright   2001-2020 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package WoltLabSuite\Core\System\User\Authentication\Password\Algorithm
+ * @since   5.4
  */
-final class Joomla1 implements IPasswordAlgorithm {
-       /**
-        * @inheritDoc
-        */
-       public function verify(string $password, string $hash): bool {
-               [$hash, $salt] = \explode(':', $hash, 2);
-               
-               return \hash_equals($hash, $this->hashWithSalt($password, $salt));
-       }
-       
-       /**
-        * @inheritDoc
-        */
-       public function hash(string $password): string {
-               $salt = Hex::encode(\random_bytes(20));
-               
-               return $this->hashWithSalt($password, $salt).':'.$salt;
-       }
-       
-       /**
-        * Returns the hashed password, hashed with a given salt.
-        */
-       private function hashWithSalt(string $password, string $salt): string {
-               return \md5($password . $salt);
-       }
-       
-       /**
-        * @inheritDoc
-        */
-       public function needsRehash(string $hash): bool {
-               return false;
-       }
+final class Joomla1 implements IPasswordAlgorithm
+{
+    /**
+     * @inheritDoc
+     */
+    public function verify(string $password, string $hash): bool
+    {
+        [$hash, $salt] = \explode(':', $hash, 2);
+
+        return \hash_equals($hash, $this->hashWithSalt($password, $salt));
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public function hash(string $password): string
+    {
+        $salt = Hex::encode(\random_bytes(20));
+
+        return $this->hashWithSalt($password, $salt) . ':' . $salt;
+    }
+
+    /**
+     * Returns the hashed password, hashed with a given salt.
+     */
+    private function hashWithSalt(string $password, string $salt): string
+    {
+        return \md5($password . $salt);
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public function needsRehash(string $hash): bool
+    {
+        return false;
+    }
 }