Registry / auth-security / cryptg

cryptg

JSON →
library0.6.0pypypi✓ verified 89d ago

Cryptographic utilities for Telegram, implementing MTProto encryption primitives (AES-IGE, AES-CTR, IGE mode, key generation). Version 0.6.0, supports Python >=3.11, actively maintained.

pip install cryptg
INSTALL
IMPORT
SIG · CRYPTG
C
cryptg
auth-securitypythonv0.6.0
Install
1.6s avg
Import
—
Disk
17MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v0.5.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
build_error
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 1.6s · import 0.000s · 19MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

encrypt_ige
✓ from cryptg import encrypt_ige
MTProto IGE encryption
decrypt_ige
✓ from cryptg import decrypt_ige
MTProto IGE decryption
encrypt_aes_ctr
✓ from cryptg import encrypt_aes_ctr
AES-CTR encryption
decrypt_aes_ctr
✓ from cryptg import decrypt_aes_ctr
AES-CTR decryption
generate_key
✓ from cryptg import generate_key
Generate AES key
aes_ige_encrypt
✓ from cryptg import aes_ige_encrypt
✗ from cryptg import ige_encrypt
Correct name includes aes_ prefix
aes_ige_decrypt
✓ from cryptg import aes_ige_decrypt
✗ from cryptg import ige_decrypt
Correct name includes aes_ prefix

Basic IGE encryption/decryption with random key

from cryptg import encrypt_ige, decrypt_ige, generate_key key = generate_key() # 32 bytes for AES-256 iv = bytes(32) plaintext = b'Hello Telegram' encrypted = encrypt_ige(plaintext, key, iv) decrypted = decrypt_ige(encrypted, key, iv) print(decrypted)
Debug
Known issues
gotchacryptg is low-level; do NOT use for general encryption. Designed specifically for Telegram MTProto protocol. Using it for other purposes may lead to security issues.
fix
Use libraries like cryptography or PyCryptodome for general encryption.
affects: all
breakingIn version 0.6.0, Python version requirement changed to >=3.11. Older Python versions are no longer supported.
fix
Upgrade Python to 3.11+ or pin cryptg<0.6.0.
affects: 0.6.0
deprecatedLegacy function names like `ige_encrypt` and `ige_decrypt` are deprecated; use `aes_ige_encrypt`/`aes_ige_decrypt` instead.
fix
Replace with `aes_ige_encrypt` and `aes_ige_decrypt`.
affects: 0.5.x - 0.6.0
gotchaKey and IV sizes are fixed: 32 bytes for AES-256, 32 bytes for IV in IGE. Using wrong sizes will raise an error.
fix
Use `generate_key()` to get a properly sized key, and ensure IV is 32 bytes.
affects: all
Errors
Common errors & fixes
ImportError: cannot import name 'ige_encrypt' from 'cryptg'
The function was renamed to `aes_ige_encrypt` in newer versions.
fix
Use `from cryptg import aes_ige_encrypt`
ValueError: key must be 32 bytes long
Supplied key size is not 32 bytes (AES-256 requirement).
fix
Use `generate_key()` or provide exactly 32 bytes.
cryptg requires Python >=3.11
Trying to install cryptg 0.6.0 on an older Python version.
fix
Upgrade to Python 3.11+ or install cryptg<0.6.0 (e.g., pip install cryptg==0.5.4).
Upgrade
Version history
0.6.0latest on PyPI · released Apr 12, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
34 hits · last 30 days
node
28
OpenAI (training)
2
Resources
cryptg — pip install cryptg · libregistry