Apply fixes from StyleCI
This commit is contained in:
parent
29a19c173c
commit
09b9ff319c
@ -18,7 +18,7 @@ trait Crypt
|
|||||||
{
|
{
|
||||||
$x = ($direction === 'to server') ? 0 : 8;
|
$x = ($direction === 'to server') ? 0 : 8;
|
||||||
$sha256_a = hash('sha256', $msg_key.substr($auth_key, $x, 36), true);
|
$sha256_a = hash('sha256', $msg_key.substr($auth_key, $x, 36), true);
|
||||||
$sha256_b = hash('sha256', substr($auth_key, 40+$x, 36).$msg_key, true);
|
$sha256_b = hash('sha256', substr($auth_key, 40 + $x, 36).$msg_key, true);
|
||||||
$aes_key = substr($sha256_a, 0, 8).substr($sha256_b, 8, 16).substr($sha256_a, 24, 8);
|
$aes_key = substr($sha256_a, 0, 8).substr($sha256_b, 8, 16).substr($sha256_a, 24, 8);
|
||||||
$aes_iv = substr($sha256_b, 0, 8).substr($sha256_a, 8, 16).substr($sha256_b, 24, 8);
|
$aes_iv = substr($sha256_b, 0, 8).substr($sha256_a, 8, 16).substr($sha256_b, 24, 8);
|
||||||
|
|
||||||
@ -35,7 +35,6 @@ trait Crypt
|
|||||||
$aes_key = substr($sha1_a, 0, 8).substr($sha1_b, 8, 12).substr($sha1_c, 4, 12);
|
$aes_key = substr($sha1_a, 0, 8).substr($sha1_b, 8, 12).substr($sha1_c, 4, 12);
|
||||||
$aes_iv = substr($sha1_a, 8, 12).substr($sha1_b, 0, 8).substr($sha1_c, 16, 4).substr($sha1_d, 0, 8);
|
$aes_iv = substr($sha1_a, 8, 12).substr($sha1_b, 0, 8).substr($sha1_c, 16, 4).substr($sha1_d, 0, 8);
|
||||||
|
|
||||||
|
|
||||||
return [$aes_key, $aes_iv];
|
return [$aes_key, $aes_iv];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +39,9 @@ trait MessageHandler
|
|||||||
$seq_no = $this->generate_out_seq_no($aargs['datacenter'], $content_related);
|
$seq_no = $this->generate_out_seq_no($aargs['datacenter'], $content_related);
|
||||||
$plaintext = $this->datacenter->sockets[$aargs['datacenter']]->temp_auth_key['server_salt'].$this->datacenter->sockets[$aargs['datacenter']]->session_id.$message_id.pack('VV', $seq_no, strlen($message_data)).$message_data;
|
$plaintext = $this->datacenter->sockets[$aargs['datacenter']]->temp_auth_key['server_salt'].$this->datacenter->sockets[$aargs['datacenter']]->session_id.$message_id.pack('VV', $seq_no, strlen($message_data)).$message_data;
|
||||||
$padding = $this->posmod(-strlen($plaintext), 16);
|
$padding = $this->posmod(-strlen($plaintext), 16);
|
||||||
if ($padding < 12) $padding += 16;
|
if ($padding < 12) {
|
||||||
|
$padding += 16;
|
||||||
|
}
|
||||||
$padding = $this->random($padding);
|
$padding = $this->random($padding);
|
||||||
|
|
||||||
$message_key = substr(hash('sha256', substr($this->datacenter->sockets[$aargs['datacenter']]->temp_auth_key['auth_key'], 88, 32).$plaintext.$padding, true), 8, 16);
|
$message_key = substr(hash('sha256', substr($this->datacenter->sockets[$aargs['datacenter']]->temp_auth_key['auth_key'], 88, 32).$plaintext.$padding, true), 8, 16);
|
||||||
|
Loading…
Reference in New Issue
Block a user