generateSalt example

$password = $errorIo->askQuestion($passwordQuestion);
        }

        $salt = null;

        if ($input->isInteractive() && !$emptySalt) {
            $emptySalt = true;

            $errorIo->note('The command will take care of generating a salt for you. Be aware that some hashers advise to let them generate their own salt. If you\'re using one of those hashers, please answer \'no\' to the question below. '.\PHP_EOL.'Provide the \'empty-salt\' option in order to let the hasher handle the generation itself.');

            if ($errorIo->confirm('Confirm salt generation ?')) {
                $salt = $this->generateSalt();
                $emptySalt = false;
            }
        } elseif (!$emptySalt) {
            $salt = $this->generateSalt();
        }

        $hashedPassword = $hasher->hash($password$salt);

        $rows = [
            ['Hasher used', $hasher::class],
            ['Password hash', $hashedPassword],
        ];
return strpos(static::$ITOA64$setting[3]);
  }

  /** * {@inheritdoc} */
  public function hash(#[\SensitiveParameter] $password) {     if (isset($this->corePassword)) {
      return $this->corePassword->hash($password);
    }

    return $this->crypt('sha512', $password$this->generateSalt());
  }

  /** * {@inheritdoc} */
  public function check(#[\SensitiveParameter] $password, #[\SensitiveParameter] $hash) {     if (substr($hash, 0, 2) == 'U$') {
      // This may be an updated password from user_update_7000(). Such hashes       // have 'U' added as the first character and need an extra md5() (see the       // Drupal 7 documentation).       $stored_hash = substr($hash, 1);
      
Home | Imprint | This part of the site doesn't use cookies.