2019-01-17 14:23:46 +00:00
|
|
|
Fast Crypto
|
|
|
|
===========
|
2018-02-17 13:44:59 +00:00
|
|
|
|
|
|
|
Pyrogram's speed can be *dramatically* boosted up by TgCrypto_, a high-performance, easy-to-install Telegram Crypto
|
2019-05-23 16:59:29 +00:00
|
|
|
Library specifically written in C for Pyrogram [1]_ as a Python extension.
|
2018-02-17 13:44:59 +00:00
|
|
|
|
|
|
|
TgCrypto is a replacement for the much slower PyAES and implements the crypto algorithms Telegram requires, namely
|
|
|
|
**AES-IGE 256 bit** (used in MTProto v2.0) and **AES-CTR 256 bit** (used for CDN encrypted files).
|
|
|
|
|
|
|
|
Installation
|
|
|
|
------------
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
2020-03-30 11:03:02 +00:00
|
|
|
$ pip3 install -U tgcrypto
|
2018-02-17 13:44:59 +00:00
|
|
|
|
|
|
|
.. note:: Being a C extension for Python, TgCrypto is an optional but *highly recommended* dependency; when TgCrypto is
|
|
|
|
not detected in your system, Pyrogram will automatically fall back to PyAES and will show you a warning.
|
|
|
|
|
|
|
|
The reason about being an optional package is that TgCrypto requires some extra system tools in order to be compiled.
|
|
|
|
The errors you receive when trying to install TgCrypto are system dependent, but also descriptive enough to understand
|
|
|
|
what you should do next:
|
|
|
|
|
2021-03-21 21:08:04 +00:00
|
|
|
- **Windows**: Install `Visual C++ 2015 Build Tools <https://www.microsoft.com/en-us/download/details.aspx?id=48159>`_.
|
|
|
|
- **macOS**: A pop-up will automatically ask you to install the command line developer tools.
|
|
|
|
- **Linux**: Install a proper C compiler (``gcc``, ``clang``) and the Python header files (``python3-dev``).
|
|
|
|
- **Termux**: Install ``clang`` package.
|
2018-02-17 13:44:59 +00:00
|
|
|
|
|
|
|
.. _TgCrypto: https://github.com/pyrogram/tgcrypto
|
|
|
|
|
2019-05-23 16:59:29 +00:00
|
|
|
.. [1] Although TgCrypto is intended for Pyrogram, it is shipped as a standalone package and can thus be used for
|
2018-02-17 13:44:59 +00:00
|
|
|
other Python projects too.
|