From 1ae804dfceb7b3cebe8069ed646691ac586f57df Mon Sep 17 00:00:00 2001 From: danogentili Date: Sat, 6 Aug 2016 00:45:17 +0200 Subject: [PATCH] Update --- mtproto.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mtproto.php b/mtproto.php index f75cec8a..0a02c114 100755 --- a/mtproto.php +++ b/mtproto.php @@ -319,11 +319,11 @@ class Session public function aes_calculate($msg_key, $direction = 'to server') { $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_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); - $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); return [$aes_key, $aes_iv];