src/Login.php
protected function authenticate()
  {
      $keys = KeyStream::GenerateKeys(base64_decode($this->password), $this->parent->getChallengeData());
      $this->inputKey = new KeyStream($keys[2], $keys[3]);
      $this->outputKey = new KeyStream($keys[0], $keys[1]);
      $array = "\0\0\0\0".$this->phoneNumber.$this->parent->getChallengeData().''.time().'000'.hex2bin('00').'000'.hex2bin('00')
       .Constants::OS_VERSION.hex2bin('00').Constants::MANUFACTURER.hex2bin('00').Constants::DEVICE.hex2bin('00').Constants::BUILD_VERSION;
      $response = $this->outputKey->EncodeMessage($array, 0, 4, strlen($array) - 4);
      $this->parent->setOutputKey($this->outputKey);

      return $response;
  }
protected function authenticate()
  {
      $keys = KeyStream::GenerateKeys(base64_decode($this->password), $this->parent->getChallengeData());
      $this->inputKey = new KeyStream($keys[2], $keys[3]);
      $this->outputKey = new KeyStream($keys[0], $keys[1]);
      $array = "\0\0\0\0".$this->phoneNumber.$this->parent->getChallengeData().''.time().'000'.hex2bin('00').'000'.hex2bin('00')
       .Constants::OS_VERSION.hex2bin('00').Constants::MANUFACTURER.hex2bin('00').Constants::DEVICE.hex2bin('00').Constants::BUILD_VERSION;
      $response = $this->outputKey->EncodeMessage($array, 0, 4, strlen($array) - 4);
      $this->parent->setOutputKey($this->outputKey);

      return $response;
  }
protected function authenticate ( ) { $ keys = KeyStream :: GenerateKeys ( base64_decode ( $ this -> password ) , $ this -> parent -> getChallengeData ( ) ) ; $ this -> inputKey = new KeyStream ( $ keys [ 2 ] , $ keys [ 3 ] ) ; $ this -> outputKey = new KeyStream ( $ keys [ 0 ] , $ keys [ 1 ] ) ; $ array = "\0\0\0\0" . $ this -> phoneNumber . $ this -> parent -> getChallengeData ( ) . '' . time ( ) . '000' . hex2bin ( '00' ) . '000' . hex2bin ( '00' ) . Constants :: OS_VERSION . hex2bin ( '00' ) . Constants :: MANUFACTURER . hex2bin ( '00' ) . Constants :: DEVICE . hex2bin ( '00' ) . Constants :: BUILD_VERSION ; $ response = $ this -> outputKey -> EncodeMessage ( $ array , 0 , 4 , strlen ( $ array ) - 4 ) ; $ this -> parent -> setOutputKey ( $ this -> outputKey ) ; return $ response ; }
Authenticate with the WhatsApp Server.

@return string Returns binary string
Authenticate with the WhatsApp Server .