Documentation
¶
Overview ¶
Copyright (c) 2025 @AmarnathCJD
Index ¶
- func DoRSAencrypt(block []byte, key *rsa.PublicKey) ([]byte, error)
- func Factorize(pq *big.Int) (*big.Int, *big.Int)
- func MakeGAB(g int32, g_a, dh_prime *big.Int) (b, g_b, g_ab *big.Int)
- func SplitPQ(pq *big.Int) (p, q *big.Int)
- func ValidateDHParams(g int32, g_a, dh_prime *big.Int) error
- func ValidateGB(g_b, dh_prime *big.Int) error
- func XOR(dst, src []byte)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DoRSAencrypt ¶
DoRSAencrypt encrypts exactly one message block of size 255 bytes using the given public key. This is a custom algorithm for MTProto. The Telegram documentation does not specify whether this encryption follows OAEP or any other standard padding scheme. Use only for MTProto protocol blocks, not for general-purpose RSA encryption.
func SplitPQ ¶
SplitPQ factors a composite number pq into two prime numbers p and q, ensuring p < q. This is used in Diffie-Hellman key exchange, where factoring pq is required for protocol security checks. The function implements Pollard's rho algorithm for integer factorization, which is efficient for numbers with small factors.
func ValidateDHParams ¶ added in v1.7.5
func ValidateGB ¶ added in v1.7.5
Types ¶
This section is empty.