From 19517be0695f85890906aafce2e7af5d85865e73 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Thu, 21 Jul 2016 11:54:46 +0200 Subject: [PATCH] update --- mtproto.php | 4 +++- mtproto.py | 4 ++-- prime.py | 1 - 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/mtproto.php b/mtproto.php index fc00a555..9db6d249 100755 --- a/mtproto.php +++ b/mtproto.php @@ -281,7 +281,9 @@ class Session $public_key_fingerprint = $ResPQ['server_public_key_fingerprints'][0]; $pq_bytes = $ResPQ['pq']; $pq = bytes_to_long($pq_bytes); - //var_dump($this->PrimeModule->pollard_brent(2118588165281151121)); + $opq = new \phpseclib\Math\BigInteger($pq_bytes, 256); + var_dump($pq, $opq->toString()); die; + var_dump($this->PrimeModule->pollard_brent(15)); var_dump($this->PrimeModule->primefactors(1724114033281923457)); var_dump($this->PrimeModule->primefactors(378221), $this->PrimeModule->primefactors(15)); die; diff --git a/mtproto.py b/mtproto.py index 06991c11..513e9674 100644 --- a/mtproto.py +++ b/mtproto.py @@ -146,9 +146,9 @@ class Session: pq_bytes = ResPQ['pq'] pq = bytes_to_long(pq_bytes) - # print(prime.pollard_brent(2118588165281151121)) - print(prime.primefactors(1724114033281923457)) + print(prime.pollard_brent(15)) exit() + print(prime.primefactors(1724114033281923457)) [p, q] = prime.primefactors(pq) if p > q: (p, q) = (q, p) assert p*q == pq and p < q diff --git a/prime.py b/prime.py index 0f36f831..d75bfbd8 100644 --- a/prime.py +++ b/prime.py @@ -67,7 +67,6 @@ def pollard_brent(n): x = y for i in range(r): y = (pow(y, 2, n) + c) % n - print(y) k = 0 while k < r and g==1: