TgCrypto
Fast and Portable Cryptography Extension Library for Pyrogram
Decision gist · record as of 2026-08-14
Yes, if you are actively developing with Pyrogram and need Telegram's specific cipher implementations. No, if you are seeking general-purpose AES encryption or an actively maintained cryptography library—use a modern alternative like cryptography or PyCryptodome instead. The abandoned status means no security patches or Python version support beyond 3.11 should be expected.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.7 or higher.
- IGE and CBC modes require data padded to a multiple of 16 bytes.
- CTR mode requires a state parameter (typically bytes(1) for initialization).
License · maintenance · safety
LGPLv3+ (copyleft) — LGPLv3+ is copyleft: any derivative work must be licensed under compatible terms. Linking or bundling TgCrypto in a proprietary application requires careful license compliance review.
last release 2022-11-11 (1372 days) · last repo commit 2024-12-23 · 211 stars · archived
0 known vulnerabilities (OSV.dev, 2026-08-14) · 610,433 downloads/mo, #5,766 on PyPI
Alternatives
Verify before relying
pip install tgcrypto
import tgcrypto
import os
data = os.urandom(32)
key = os.urandom(32)
iv = os.urandom(32)
data += bytes(-len(data) % 16) # Pad to 16-byte boundary
encrypted = tgcrypto.ige256_encrypt(data, key, iv)
decrypted = tgcrypto.ige256_decrypt(encrypted, key, iv)- Whether the abandoned status and lack of recent maintenance pose security or compatibility risks for new Python versions beyond 3.11.
- Whether pre-built wheels cover all target platforms or if source compilation is needed on some systems.
What it is and what it does
TgCrypto is a C extension library that implements three AES-256 encryption modes required by Telegram's protocols: IGE (used in MTProto v2.0), CTR (used for CDN encrypted files), and CBC (used for encrypted passport credentials). It wraps low-level cryptographic operations in a minimal Python API of six functions—three encrypt/decrypt pairs—and is designed to be fast and portable across platforms.
The library is tightly coupled to Pyrogram, Telegram's Python client library, and is not a general-purpose cryptography tool. It has no runtime dependencies and installs via pre-built wheels for common platforms (Windows, macOS, Linux on x86 and ARM). However, the project is archived and abandoned: the last release was November 2022, and while the repository received a final commit in December 2024, no active maintenance or security updates should be expected.
Use it for
- Encrypt and decrypt MTProto messages when building or extending Telegram client applications with Pyrogram.
- Handle CDN file encryption/decryption for Telegram file transfers in custom Telegram integrations.
- Implement Telegram Passport credential encryption for identity verification workflows in Telegram bots or clients.
- Stream large encrypted payloads using CTR mode with stateful encryption state across multiple chunks.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you are actively developing with Pyrogram and need Telegram's specific cipher implementations.
No, if you are seeking general-purpose AES encryption or an actively maintained cryptography library—use a modern alternative like cryptography or PyCryptodome instead. The abandoned status means no security patches or Python version support beyond 3.11 should be expected.
Install
tgcrypto on PyPI
Before you install
Medium install friction due to compiled C extension requiring platform-specific wheels. The package is abandoned (last release November 2022, last commit December 2024), so no active maintenance or bug fixes should be expected.
Requires Python 3.7 or higher. IGE and CBC modes require data padded to a multiple of 16 bytes. CTR mode requires a state parameter (typically bytes(1) for initialization).
License in practice
LGPLv3+ is copyleft: any derivative work must be licensed under compatible terms. Linking or bundling TgCrypto in a proprietary application requires careful license compliance review.
Quickstart
pip install tgcrypto
import tgcrypto
import os
data = os.urandom(32)
key = os.urandom(32)
iv = os.urandom(32)
data += bytes(-len(data) % 16) # Pad to 16-byte boundary
encrypted = tgcrypto.ige256_encrypt(data, key, iv)
decrypted = tgcrypto.ige256_decrypt(encrypted, key, iv)
Verify before relying
- Whether the abandoned status and lack of recent maintenance pose security or compatibility risks for new Python versions beyond 3.11.
- Whether pre-built wheels cover all target platforms or if source compilation is needed on some systems.
Package facts
| License | LGPLv3+ copyleft |
| Python support | Supports the current Python release ~=3.7 |
| Install friction | Medium. Platform-specific wheel |
| Runtime dependencies | None |
| Maintenance | Abandoned 1,372 days since the last release |
| Last repo commit | repository archived |
| First released | |
| Downloads | 610,433 / month, #5,766 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)Operating System :: OS IndependentProgramming Language :: CProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: ImplementationProgramming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: CommunicationsTopic :: Communications :: ChatTopic :: InternetTopic :: SecurityTopic :: Security :: CryptographyTopic :: Software Development :: LibrariesTopic :: Software Development :: Libraries :: Python Modules |
Evidence: TgCrypto-1.2.5-cp310-cp310-macosx_10_9_universal2.whl; TgCrypto-1.2.5-cp310-cp310-macosx_10_9_x86_64.whl; TgCrypto-1.2.5-cp310-cp310-macosx_11_0_arm64.whl; TgCrypto-1.2.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; TgCrypto-1.2.5-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl; TgCrypto-1.2.5-cp310-cp310-musllinux_1_1_i686.whl; TgCrypto-1.2.5-cp310-cp310-musllinux_1_1_x86_64.whl; TgCrypto-1.2.5-cp310-cp310-win32.whl; TgCrypto-1.2.5-cp310-cp310-win_amd64.whl; TgCrypto-1.2.5-cp311-cp311-macosx_10_9_universal2.whl; TgCrypto-1.2.5-cp311-cp311-macosx_10_9_x86_64.whl; TgCrypto-1.2.5-cp311-cp311-macosx_11_0_arm64.whl; TgCrypto-1.2.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; TgCrypto-1.2.5-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl; TgCrypto-1.2.5-cp311-cp311-musllinux_1_1_i686.whl; TgCrypto-1.2.5-cp311-cp311-musllinux_1_1_x86_64.whl; TgCrypto-1.2.5-cp311-cp311-win32.whl; TgCrypto-1.2.5-cp311-cp311-win_amd64.whl; TgCrypto-1.2.5-cp37-cp37m-macosx_10_9_x86_64.whl; TgCrypto-1.2.5-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “telegram encryption library”
- TgCryptoTgCrypto provides fast C-based implementations of AES-256 encryption…
- cryptgcryptg provides a native Python extension that implements AES-IGE…
- TelethonTelethon is an asyncio-based Python library that implements the…
Give your agent the search over MCP, or paste the wish link into any chat.
More Libraries packages
urllib3 is an HTTP client library that provides thread-safe connection pooling, SSL/TLS verification, multipart file uploads, request retries, compression support, and proxy handling for Python applications.
Requests is a Python HTTP library that simplifies sending HTTP/1.1 requests with automatic handling of headers, authentication, cookies, and response parsing.
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
Provides parsing, arithmetic, and recurrence rule computation for dates and times, with timezone support and iCalendar RFC compliance.
Install it if you need to parse flexible date strings, compute relative dates, handle timezones, or work with recurrence rules—it's the de facto choice for these tasks.
Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.
pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.
See also cryptg · oscrypto · Pyrogram · unicrypto · crypto · sslcrypto · pytgcalls · pyAesCrypt · aes-pkcs5 · snitun