function PhpassHashedPasswordBase::enforceLog2Boundaries

Same name in other branches
  1. 11.x core/lib/Drupal/Core/Password/PhpassHashedPasswordBase.php \Drupal\Core\Password\PhpassHashedPasswordBase::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.

3 calls to PhpassHashedPasswordBase::enforceLog2Boundaries()
PhpassHashedPasswordBase::crypt in core/lib/Drupal/Core/Password/PhpassHashedPasswordBase.php
Hash a password using a secure stretched hash.
PhpassHashedPasswordBase::needsRehash in core/lib/Drupal/Core/Password/PhpassHashedPasswordBase.php
PhpassHashedPasswordBase::__construct in core/lib/Drupal/Core/Password/PhpassHashedPasswordBase.php
Constructs a new password hashing instance.

File

core/lib/Drupal/Core/Password/PhpassHashedPasswordBase.php, line 160

Class

PhpassHashedPasswordBase
Legacy 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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.