Expand description
Cryptographic primitives for Telegram MTProto.
Provides:
- AES-256-IGE encryption/decryption
- SHA-1 / SHA-256 hash macros
- Pollard-rho PQ factorization
- RSA padding (MTProto RSA-PAD scheme)
AuthKey— 256-byte session key- MTProto 2.0 message encryption / decryption
- DH nonce→key derivation
Modules§
- aes
- AES-IGE (Infinite Garble Extension) — used by Telegram’s MTProto.
- rsa
- RSA padding used by Telegram’s auth key exchange.
Macros§
- sha1
- Calculate the SHA-1 hash of one or more byte slices concatenated.
- sha256
- Calculate the SHA-256 hash of one or more byte slices concatenated.
Structs§
- AuthKey
- A Telegram authorization key (256 bytes) plus pre-computed identifiers.
- Deque
Buffer - Growable byte buffer that supports efficient front-extension.
Enums§
- Decrypt
Error - Errors from
decrypt_data_v2.
Functions§
- decrypt_
data_ v2 - Decrypt an MTProto 2.0 ciphertext.
- encrypt_
data_ v2 - Encrypt
buffer(in-place, with prepended header) using MTProto 2.0. - factorize
- Factorize
pqinto two prime factors(p, q)wherep ≤ q. - generate_
key_ data_ from_ nonce - Derive
(key, iv)from nonces for decryptingServerDhParams.encrypted_answer.