Skip to main content

wide_redc

Function wide_redc 

Source
pub fn wide_redc<T>(t_lo: T, t_hi: T, modulus: T, n_prime: T) -> T
Expand description

REDC on a double-width input (t_lo, t_hi).

Computes (t_lo + t_hi * 2^W) * R^{-1} mod N.

Invariants:

  • Inputs t_lo, t_hi represent a value T < N * R (product of two values < N)
  • modulus is odd and non-zero
  • n_prime = -N^{-1} mod 2^W