--- id: tgcrypto version: "1.2.5" license: LGPLv3+ license_treatment: copyleft maintenance: abandoned --- # TgCrypto — Fast and Portable Cryptography Extension Library for Pyrogram License: copyleft · Maintenance: abandoned · Downloads: 610.4K/mo ## 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 above — verify before relying. TgCrypto provides fast C-based implementations of AES-256 encryption in IGE, CTR, and CBC modes, designed specifically for Telegram's MTProto protocol and related cryptographic needs. 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 pip install tgcrypto uv add tgcrypto poetry add tgcrypto ## Installing TgCrypto 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. 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) 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). 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_current - Install friction: medium - Maintenance: abandoned - Downloads: 610.4K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags telegram encryption library, AES-256 IGE CTR CBC, MTProto cryptography, pyrogram crypto extension, fast telegram cipher, AES encryption modes, telegram protocol crypto, telegram-protocol, c-extension, abandoned [View on SkillFed](https://skillfed.io/packages/tgcrypto) · [View on PyPI](https://pypi.org/project/tgcrypto/)