Update
This commit is contained in:
parent
b6aed57a46
commit
1ae804dfce
@ -319,11 +319,11 @@ class Session
|
|||||||
public function aes_calculate($msg_key, $direction = 'to server')
|
public function aes_calculate($msg_key, $direction = 'to server')
|
||||||
{
|
{
|
||||||
$x = ($direction == 'to server') ? 0 : 8;
|
$x = ($direction == 'to server') ? 0 : 8;
|
||||||
$sha1_a = sha1($msg_key . substr($this->auth_key, $x, ($x + 32) - $x)), true);
|
$sha1_a = sha1($msg_key . substr($this->auth_key, $x, ($x + 32) - $x), true);
|
||||||
$sha1_b = sha1(substr($this->auth_key, ($x + 32), ($x + 48) - ($x + 32)) . $msg_key . substr($this->auth_key, (48 + $x), (64 + $x) - (48 + $x)), true);
|
$sha1_b = sha1(substr($this->auth_key, ($x + 32), ($x + 48) - ($x + 32)) . $msg_key . substr($this->auth_key, (48 + $x), (64 + $x) - (48 + $x)), true);
|
||||||
$sha1_c = sha1(substr($this->auth_key, ($x + 64), ($x + 96) - ($x + 64)) . $msg_key, true);
|
$sha1_c = sha1(substr($this->auth_key, ($x + 64), ($x + 96) - ($x + 64)) . $msg_key, true);
|
||||||
$sha1_d = sha1($msg_key . substr($this->auth_key, ($x + 96), ($x + 128) - ($x + 96)), true);
|
$sha1_d = sha1($msg_key . substr($this->auth_key, ($x + 96), ($x + 128) - ($x + 96)), true);
|
||||||
$aes_key = substr($sha1_a, 0, 8 - 0) . substr($sha1_b, 8, 20 - 8)) . substr($sha1_c, 4, 16 - 4;
|
$aes_key = substr($sha1_a, 0, 8 - 0) . substr($sha1_b, 8, 20 - 8) . substr($sha1_c, 4, 16 - 4);
|
||||||
$aes_iv = substr($sha1_a, 8, 20 - 8) . substr($sha1_b, 0, 8 - 0) . substr($sha1_c, 16, 20 - 16) . substr($sha1_d, 0, 8 - 0);
|
$aes_iv = substr($sha1_a, 8, 20 - 8) . substr($sha1_b, 0, 8 - 0) . substr($sha1_c, 16, 20 - 16) . substr($sha1_d, 0, 8 - 0);
|
||||||
|
|
||||||
return [$aes_key, $aes_iv];
|
return [$aes_key, $aes_iv];
|
||||||
|
Loading…
Reference in New Issue
Block a user