From 40d6deaa13916d14099f996ffaf7870ffb3fea09 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Mon, 10 Oct 2016 22:05:43 +0000 Subject: [PATCH] Applied fixes from StyleCI --- .../MadelineProto/MTProtoTools/MessageHandler.php | 2 +- src/danog/MadelineProto/PrimeModule.php | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/danog/MadelineProto/MTProtoTools/MessageHandler.php b/src/danog/MadelineProto/MTProtoTools/MessageHandler.php index 77d50f37..277c62d3 100644 --- a/src/danog/MadelineProto/MTProtoTools/MessageHandler.php +++ b/src/danog/MadelineProto/MTProtoTools/MessageHandler.php @@ -64,7 +64,7 @@ class MessageHandler extends Crypt $server_salt = $this->struct->unpack('settings['authorization']['temp_auth_key']['server_salt']) { -// throw new Exception('Server salt mismatch (my server salt '.$this->settings['authorization']['temp_auth_key']['server_salt'].' is not equal to server server salt '.$server_salt.').'); + // throw new Exception('Server salt mismatch (my server salt '.$this->settings['authorization']['temp_auth_key']['server_salt'].' is not equal to server server salt '.$server_salt.').'); } $session_id = substr($decrypted_data, 8, 8); diff --git a/src/danog/MadelineProto/PrimeModule.php b/src/danog/MadelineProto/PrimeModule.php index 33dba158..72c72201 100644 --- a/src/danog/MadelineProto/PrimeModule.php +++ b/src/danog/MadelineProto/PrimeModule.php @@ -15,7 +15,8 @@ namespace danog\MadelineProto; class PrimeModule extends Tools { // Uses https://github.com/LonamiWebs/Telethon/blob/master/telethon/crypto/factorizator.py, thank you so freaking much! - function find_small_multiplier_lopatin($what) { + public function find_small_multiplier_lopatin($what) + { $g = 0; foreach ($this->range(3) as $i) { $q = (rand(0, 127) & 15) + 17; @@ -55,7 +56,9 @@ class PrimeModule extends Tools $p = $what; // g return min($p, $g); } - function gcd($a, $b){ + + public function gcd($a, $b) + { while ($a != 0 && $b != 0) { while ($b & 1 == 0) { $b >>= 1; @@ -77,7 +80,7 @@ class PrimeModule extends Tools { // Use the native version $pqstr = (string) $pq; - $res = $this->find_small_multiplier_lopatin((int)$pqstr); + $res = $this->find_small_multiplier_lopatin((int) $pqstr); $res = [$res, $pqstr / $res]; if ($res[1] != 1) { return $res; @@ -85,7 +88,6 @@ class PrimeModule extends Tools // Use the python version. if (function_exists('shell_exec')) { try { - $res = json_decode(shell_exec('python '.__DIR__.'/getpq.py '.$pqstr)); if (count($res) == 2) { return $res;