You are here

protected function PhpassHashedPassword::enforceLog2Boundaries in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Password/PhpassHashedPassword.php \Drupal\Core\Password\PhpassHashedPassword::enforceLog2Boundaries()

Ensures that $count_log2 is within set bounds.

Parameters

int $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

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

4 calls to PhpassHashedPassword::enforceLog2Boundaries()
FakePhpassHashedPassword::enforceLog2Boundaries in core/tests/Drupal/Tests/Core/Password/PasswordHashingTest.php
Ensures that $count_log2 is within set bounds.
PhpassHashedPassword::crypt in core/lib/Drupal/Core/Password/PhpassHashedPassword.php
Hash a password using a secure stretched hash.
PhpassHashedPassword::needsRehash in core/lib/Drupal/Core/Password/PhpassHashedPassword.php
Check whether a hashed password needs to be replaced with a new hash.
PhpassHashedPassword::__construct in core/lib/Drupal/Core/Password/PhpassHashedPassword.php
Constructs a new password hashing instance.
1 method overrides PhpassHashedPassword::enforceLog2Boundaries()
FakePhpassHashedPassword::enforceLog2Boundaries in core/tests/Drupal/Tests/Core/Password/PasswordHashingTest.php
Ensures that $count_log2 is within set bounds.

File

core/lib/Drupal/Core/Password/PhpassHashedPassword.php, line 128
Contains \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;
}