Skip to content

miniproto.crypto.native.pq_factorize

pq_factorize(pq: int) -> tuple[int, int]

Factor the composite integer used by the MTProto handshake.

Parameters:

  • pq (int) – A composite integer greater than or equal to four.

Returns:

  • tuple[int, int] – The two factors in ascending order.

Raises:

Uses the selected backend’s Pollard-rho-style implementation. It is a protocol helper, not a general-purpose factorization service; runtime grows with the input and no fixed latency guarantee is made.