private function hashModePbkdf2($password)
    {
        $this->cwsDebug->titleH2('Create password hash using PBKDF2');
        $this->cwsDebug->labelValue('Password', $password);

        $salt = $this->random(self::PBKDF2_RANDOM_BYTES);
        $this->cwsDebug->labelValue('Salt', $salt);

        $algorithm = $this->encode(self::PBKDF2_ALGORITHM);
        $this->cwsDebug->labelValue('Algorithm', self::PBKDF2_ALGORITHM);

        $ite = rand(self::PBKDF2_MIN_ITE, self::PBKDF2_MAX_ITE);
        $this->cwsDebug->labelValue('Iterations', $ite);
        $ite = $this->encode(rand(self::PBKDF2_MIN_ITE, self::PBKDF2_MAX_ITE));

        $params = $algorithm.self::PBKDF2_SEPARATOR;
        $params .= $ite.self::PBKDF2_SEPARATOR;
        $params .= $salt.self::PBKDF2_SEPARATOR;

        $hash = $this->getPbkdf2($algorithm, $password, $salt, $ite, self::PBKDF2_HASH_BYTES, true);
        $this->cwsDebug->labelValue('Hash', $hash);
        $this->cwsDebug->labelValue('Length', strlen($hash));

        $finalHash = $params.base64_encode($hash);
        $this->cwsDebug->dump('Encoded hash (length : '.strlen($finalHash).')', $finalHash);

        if (strlen($finalHash) == self::PBKDF2_LENGTH) {
            return $finalHash;
        }

        $this->error = 'Cannot generate the PBKDF2 password hash...';
        $this->cwsDebug->error($this->error);
    }
private function hashModePbkdf2($password)
    {
        $this->cwsDebug->titleH2('Create password hash using PBKDF2');
        $this->cwsDebug->labelValue('Password', $password);

        $salt = $this->random(self::PBKDF2_RANDOM_BYTES);
        $this->cwsDebug->labelValue('Salt', $salt);

        $algorithm = $this->encode(self::PBKDF2_ALGORITHM);
        $this->cwsDebug->labelValue('Algorithm', self::PBKDF2_ALGORITHM);

        $ite = rand(self::PBKDF2_MIN_ITE, self::PBKDF2_MAX_ITE);
        $this->cwsDebug->labelValue('Iterations', $ite);
        $ite = $this->encode(rand(self::PBKDF2_MIN_ITE, self::PBKDF2_MAX_ITE));

        $params = $algorithm.self::PBKDF2_SEPARATOR;
        $params .= $ite.self::PBKDF2_SEPARATOR;
        $params .= $salt.self::PBKDF2_SEPARATOR;

        $hash = $this->getPbkdf2($algorithm, $password, $salt, $ite, self::PBKDF2_HASH_BYTES, true);
        $this->cwsDebug->labelValue('Hash', $hash);
        $this->cwsDebug->labelValue('Length', strlen($hash));

        $finalHash = $params.base64_encode($hash);
        $this->cwsDebug->dump('Encoded hash (length : '.strlen($finalHash).')', $finalHash);

        if (strlen($finalHash) == self::PBKDF2_LENGTH) {
            return $finalHash;
        }

        $this->error = 'Cannot generate the PBKDF2 password hash...';
        $this->cwsDebug->error($this->error);
    }
private function hashModePbkdf2 ( $ password ) { $ this -> cwsDebug -> titleH2 ( 'Create password hash using PBKDF2' ) ; $ this -> cwsDebug -> labelValue ( 'Password' , $ password ) ; $ salt = $ this -> random ( self :: PBKDF2_RANDOM_BYTES ) ; $ this -> cwsDebug -> labelValue ( 'Salt' , $ salt ) ; $ algorithm = $ this -> encode ( self :: PBKDF2_ALGORITHM ) ; $ this -> cwsDebug -> labelValue ( 'Algorithm' , self :: PBKDF2_ALGORITHM ) ; $ ite = rand ( self :: PBKDF2_MIN_ITE , self :: PBKDF2_MAX_ITE ) ; $ this -> cwsDebug -> labelValue ( 'Iterations' , $ ite ) ; $ ite = $ this -> encode ( rand ( self :: PBKDF2_MIN_ITE , self :: PBKDF2_MAX_ITE ) ) ; $ params = $ algorithm . self :: PBKDF2_SEPARATOR ; $ params .= $ ite . self :: PBKDF2_SEPARATOR ; $ params .= $ salt . self :: PBKDF2_SEPARATOR ; $ hash = $ this -> getPbkdf2 ( $ algorithm , $ password , $ salt , $ ite , self :: PBKDF2_HASH_BYTES , true ) ; $ this -> cwsDebug -> labelValue ( 'Hash' , $ hash ) ; $ this -> cwsDebug -> labelValue ( 'Length' , strlen ( $ hash ) ) ; $ finalHash = $ params . base64_encode ( $ hash ) ; $ this -> cwsDebug -> dump ( 'Encoded hash (length : ' . strlen ( $ finalHash ) . ')' , $ finalHash ) ; if ( strlen ( $ finalHash ) == self :: PBKDF2_LENGTH ) { return $ finalHash ; } $ this -> error = 'Cannot generate the PBKDF2 password hash...' ; $ this -> cwsDebug -> error ( $ this -> error ) ; }
Create a password hash using PBKDF2 mode.

@param string $password

@return string|null
Create a password hash using PBKDF2 mode .