Skip to main content

ct_mod_mp_mp

Function ct_mod_mp_mp 

Source
pub fn ct_mod_mp_mp<UT: MpMutUIntSlice, VT: MpUIntCommon>(
    u_h: Option<&mut UT>,
    u_l: &mut UT,
    v: &CtMpDivisor<'_, VT>,
)
Expand description

Compute the remainder of a multiprecision integer division.

Like ct_div_mp_mp(), but don’t compute the quotient. The remainder replaces the dividend, given as the virtual concatenation of u_h and u_l, and is less than the divisor.

Execution time depends only on the lengths in units of bytes of u_h and u_l, as well as on the divisor value’s length without any leading zero bytes, which is not considered secret, c.f. CtMpDivisor, and is otherwise constant as far as branching is concerned. The computation cost is O(m · n), where m is the dividend’s and n the divisor value’s length. See ct_mod_pow2_mp(), ct_mod_lshifted_mp_mp() and ct_mod_mp_l() for specialized variants for power of two dividends, for dividends shifted to the left by some number of bytes, and for single LimbType divisors respectively.

§Arguments

  • u_h - The dividend’s optional high part. It will be overwritten by the corresponding part of the remainder.
  • u_l - The dividend’s low part. It will be overwritten by the corresponding part of the remainder.
  • v - The divisor.