function PhpassHashedPasswordBase::enforceLog2Boundaries

Same name in other branches
  1. 10 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.

1 call to PhpassHashedPasswordBase::enforceLog2Boundaries()
PhpassHashedPasswordBase::crypt in core/lib/Drupal/Core/Password/PhpassHashedPasswordBase.php
Hash a password using a secure stretched hash.

File

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

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.