Move the Drupal8 costs into a class constant
authorTim Düsterhus <duesterhus@woltlab.com>
Thu, 28 Apr 2022 12:08:12 +0000 (14:08 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Thu, 28 Apr 2022 12:08:12 +0000 (14:08 +0200)
wcfsetup/install/files/lib/system/user/authentication/password/algorithm/Drupal8.class.php

index f7195c0decdc9a03590d84040ed5f6be02fded7c..1963e69fea201fee172700b7da9fc04db2ddc3ef 100644 (file)
@@ -18,6 +18,8 @@ final class Drupal8 implements IPasswordAlgorithm
 {
     use TPhpass;
 
+    private const COSTS = 15;
+
     /**
      * Returns the hashed password, with the given settings.
      */
@@ -45,7 +47,8 @@ final class Drupal8 implements IPasswordAlgorithm
      */
     public function hash(string $password): string
     {
-        $settings = '$S$D';
+        $settings = '$S$';
+        $settings .= $this->itoa64[self::COSTS];
         $settings .= Hex::encode(\random_bytes(4));
 
         return $this->hashDrupal($password, $settings) . ':';