Skip to main content

coppersmith_factor_high_bits

Function coppersmith_factor_high_bits 

Source
pub fn coppersmith_factor_high_bits(
    n: &BigInt,
    p_high: &BigInt,
    unknown_bits: u32,
) -> Option<(BigInt, BigInt)>
Expand description

Factor N from the high bits of one prime (Coppersmith’s method). We know p = p_high + x₀ with 0 ≤ x₀ < 2^unknown_bits; the monic linear polynomial f(x) = x + p_high has the small root x₀ modulo the unknown factor p. Coppersmith builds a lattice from the N-power and x-shift multiples of f (all vanishing modulo pᵐ at x₀), LLL-reduces it, and reads a short vector whose small root is an INTEGER root of a real polynomial — recovering x₀, hence p. This is the LATTICE lens: a factorization from PARTIAL knowledge that no factoring shortcut (Fermat, rho, p−1) can provide.