diff --git a/README.rst b/README.rst index aa5a8290..10ea7ee9 100755 --- a/README.rst +++ b/README.rst @@ -127,6 +127,11 @@ There you'll find a list of all the methods, types and available constructors. More examples are also available under the ``telethon_examples/`` folder. +If you're using Telethon under ARM, you may want to install ``sympy`` through +``pip`` for a substantial speed-up when generating the keys required to +connect to Telegram (you can of course do this on desktop too). See +`issue #199 `_ for more. + Common errors ------------- diff --git a/telethon/crypto/factorization.py b/telethon/crypto/factorization.py index e6601f5a..12a03af3 100644 --- a/telethon/crypto/factorization.py +++ b/telethon/crypto/factorization.py @@ -1,4 +1,8 @@ from random import randint +try: + import sympy.ntheory +except ImportError: + sympy = None class Factorization: @@ -58,5 +62,8 @@ class Factorization: @staticmethod def factorize(pq): """Factorizes the given number and returns both the divisor and the number divided by the divisor""" - divisor = Factorization.find_small_multiplier_lopatin(pq) - return divisor, pq // divisor + if sympy: + return tuple(sympy.ntheory.factorint(pq).keys()) + else: + divisor = Factorization.find_small_multiplier_lopatin(pq) + return divisor, pq // divisor