enforceLog2Boundaries example

$result = $passwordService->check($invalidPassword$passwordLayered);
    $this->assertFalse($result, 'Rejects invalid passwords migrated from sites running 6.x');
  }

  /** * Tests the hash count boundaries are enforced. * * @covers ::enforceLog2Boundaries */
  public function testWithinBounds() {
    $hasher = new PhpassHashedPasswordLog2BoundariesDouble();
    $this->assertEquals(PhpassHashedPassword::MIN_HASH_COUNT, $hasher->enforceLog2Boundaries(1), "Min hash count enforced");
    $this->assertEquals(PhpassHashedPassword::MAX_HASH_COUNT, $hasher->enforceLog2Boundaries(100), "Max hash count enforced");
  }

  /** * Verifies that passwords longer than 512 bytes are not hashed. * * @covers ::crypt * * @dataProvider providerLongPasswords */
  public function testLongPassword($password$allowed) {
    
if ($corePassword instanceof PasswordInterface) {
      // Note: If $corePassword is set, $countLog2 isn't used anywhere in the       // code path of this class. Still, set it to the default value for BC       // reasons.       $this->countLog2 = 16;
      $this->corePassword = $corePassword;
    }
    else {
      $countLog2 = $corePassword;
      @trigger_error('Calling ' . __METHOD__ . '() with numeric $countLog2 as the first parameter is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Use PhpassHashedPasswordInterface::__construct() with $corePassword parameter set to an instance of Drupal\Core\Password\PhpPassword instead. See https://www.drupal.org/node/3322420', E_USER_DEPRECATED);
      // Ensure that $countLog2 is within set bounds.       $this->countLog2 = $this->enforceLog2Boundaries($countLog2);
      $this->corePassword = NULL;
    }
  }

  /** * Encodes bytes into printable base 64 using the *nix standard from crypt(). * * @param string $input * The string containing bytes to encode. * @param int $count * The number of characters (bytes) to encode. * * @return string * Encoded string. */
Home | Imprint | This part of the site doesn't use cookies.