Fixed salt

This commit is contained in:
danogentili 2016-09-15 15:00:08 +02:00
parent 669b6950a8
commit bedab1388d
4 changed files with 6 additions and 4 deletions

View File

@ -20,10 +20,12 @@ class API
{
set_error_handler(['\danog\MadelineProto\Exception', 'ExceptionErrorHandler']);
$this->session = new MTProto($params);
$future_salts = $this->get_future_salts(3);
var_dump($future_salts);
$future_salts = $this->ping(3);
var_dump($future_salts);
$future_salts = $this->get_future_salts(3);
var_dump($this->session->incoming_messages);
var_dump($future_salts);
}
public function __destruct()

View File

@ -213,7 +213,7 @@ class AuthKeyHandler extends AckHandler
}
$this->log->log('Diffie Hellman key exchange processed successfully');
$res_authorization = ['server_salt' => $this->struct->unpack('<Q', substr($new_nonce, 0, 8 - 0) ^ substr($server_nonce, 0, 8 - 0))[0]];
$res_authorization = ['server_salt' => $this->struct->unpack('<q', substr($new_nonce, 0, 8 - 0) ^ substr($server_nonce, 0, 8 - 0))[0]];
$res_authorization['auth_key'] = $auth_key_str;
$res_authorization['id'] = substr($auth_key_sha, -8);
if ($expires_in < 0) {

View File

@ -25,7 +25,6 @@ class CallHandler extends AuthKeyHandler
$this->log->log('Getting response....');
$last_received = $this->recv_message();
$this->handle_message($last_sent, $last_received);
var_dump($this->incoming_messages);
if (isset($this->outgoing_messages[$last_sent]['response']) && isset($this->incoming_messages[$this->outgoing_messages[$last_sent]['response']]['content'])) {
$response = $this->incoming_messages[$this->outgoing_messages[$last_sent]['response']]['content'];
}

View File

@ -30,6 +30,7 @@ class MessageHandler extends Crypt
$message = \danog\MadelineProto\Tools::string2bin('\x00\x00\x00\x00\x00\x00\x00\x00').$message_id.$this->struct->pack('<I', strlen($message_data)).$message_data;
} else {
$seq_no = $this->generate_seq_no($content_related);
var_dump($this->settings['authorization']['temp_auth_key']['server_salt']);
$encrypted_data = $this->struct->pack('<Q', $this->settings['authorization']['temp_auth_key']['server_salt']).$this->settings['authorization']['session_id'].$message_id.$this->struct->pack('<II', $seq_no, strlen($message_data)).$message_data;
$message_key = substr(sha1($encrypted_data, true), -16);
$padding = \phpseclib\Crypt\Random::string(\danog\MadelineProto\Tools::posmod(-strlen($encrypted_data), 16));