protected function PhpassHashedPassword::enforceLog2Boundaries

Ensures that $count_log2 is within set bounds.

Parameters

Integer $count_log2: Integer that determines the number of iterations used in the hashing process. A larger value is more secure, but takes more time to complete.

Return value

Integer Integer within set bounds that is closest to $count_log2.

3 calls to PhpassHashedPassword::enforceLog2Boundaries()
PhpassHashedPassword::crypt in drupal/core/lib/Drupal/Core/Password/PhpassHashedPassword.php
Hash a password using a secure stretched hash.
PhpassHashedPassword::userNeedsNewHash in drupal/core/lib/Drupal/Core/Password/PhpassHashedPassword.php
Implements Drupal\Core\Password\PasswordInterface::userNeedsNewHash().
PhpassHashedPassword::__construct in drupal/core/lib/Drupal/Core/Password/PhpassHashedPassword.php
Constructs a new phpass password hashing instance.

File

drupal/core/lib/Drupal/Core/Password/PhpassHashedPassword.php, line 128
Definition of Drupal\Core\Password\PhpassHashedPassword

Class

PhpassHashedPassword
Secure password hashing functions based on the Portable PHP password hashing framework.

Namespace

Drupal\Core\Password

Code

protected function enforceLog2Boundaries($count_log2) {
  if ($count_log2 < static::MIN_HASH_COUNT) {
    return static::MIN_HASH_COUNT;
  }
  elseif ($count_log2 > static::MAX_HASH_COUNT) {
    return static::MAX_HASH_COUNT;
  }
  return (int) $count_log2;
}