Add support for argon2 to PasswordUtil
authorTim Düsterhus <duesterhus@woltlab.com>
Mon, 21 Sep 2020 12:56:34 +0000 (14:56 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Mon, 21 Sep 2020 15:01:35 +0000 (17:01 +0200)
wcfsetup/install/files/lib/util/PasswordUtil.class.php

index 1ac373c7826e29411e222d40c990077c831e41ea..903b6319aef84e81ca9fa0ac5ae0fc9cd7a3eacd 100644 (file)
@@ -30,6 +30,7 @@ final class PasswordUtil {
         * @var string[]
         */
        private static $supportedEncryptionTypes = [
+               'argon2',       // vBulletin 5.x
                'ipb2',         // Invision Power Board 2.x
                'ipb3',         // Invision Power Board 3.x
                'mybb1',        // MyBB 1.x
@@ -271,6 +272,19 @@ final class PasswordUtil {
                return '$' . self::BCRYPT_TYPE . '$' . self::BCRYPT_COST . '$' . $salt;
        }
        
+       /**
+        * Validates the password hash for Argon2 (argon2).
+        * 
+        * @param       string          $username
+        * @param       string          $password
+        * @param       string          $salt
+        * @param       string          $dbHash
+        * @return      boolean
+        */
+       protected static function argon2($username, $password, $salt, $dbHash) {
+               return password_verify($password, $dbHash);
+       }
+       
        /**
         * Validates the password hash for Invision Power Board 2.x (ipb2).
         *