diff --git a/core/core.services.yml b/core/core.services.yml index 6655001af1..79c43b63fb 100644 --- a/core/core.services.yml +++ b/core/core.services.yml @@ -1076,15 +1076,8 @@ services: arguments: ['@router', '@router.no_access_checks', '@current_user', '@path_processor_manager'] Drupal\Core\Path\PathValidatorInterface: '@path.validator' - # The argument to the hashing service defined in services.yml, to the - # constructor of PhpassHashedPassword is the log2 number of iterations for - # password stretching. - # @todo increase by 1 every Drupal version in order to counteract increases in - # the speed and power of computers available to crack the hashes. The current - # password hashing method was introduced in Drupal 7 with a log2 count of 15. password: class: Drupal\Core\Password\PhpassHashedPassword - arguments: [16] Drupal\Core\Password\PasswordInterface: '@password' password_generator: class: Drupal\Core\Password\DefaultPasswordGenerator diff --git a/core/lib/Drupal/Core/Password/PhpassHashedPassword.php b/core/lib/Drupal/Core/Password/PhpassHashedPassword.php index de702d3ff5..c9357affbd 100644 --- a/core/lib/Drupal/Core/Password/PhpassHashedPassword.php +++ b/core/lib/Drupal/Core/Password/PhpassHashedPassword.php @@ -8,6 +8,16 @@ * @see http://www.openwall.com/phpass/ */ class PhpassHashedPassword implements PasswordInterface { + /** + * The default log2 number of iterations for password stretching. + * + * @todo increase by 1 every Drupal version in order to counteract increases + * in the speed and power of computers available to crack the hashes. The + * current password hashing method was introduced in Drupal 7 with a log2 + * count of 15. + */ + const DEFAULT_HASH_COUNT = 16; + /** * The minimum allowed log2 number of iterations for password stretching. */ @@ -50,7 +60,7 @@ class PhpassHashedPassword implements PasswordInterface { * The number of times is calculated by raising 2 to the power of the given * value. */ - public function __construct($countLog2) { + public function __construct($countLog2 = self::DEFAULT_HASH_COUNT) { // Ensure that $countLog2 is within set bounds. $this->countLog2 = $this->enforceLog2Boundaries($countLog2); }