pub struct Modulus { /* private fields */ }Expand description
Residue ring Z_M for an odd M; parameters are shared (Arc) across clones.
Implementations§
Source§impl Modulus
impl Modulus
pub fn new(m: BoxedUint) -> Result<Self>
pub fn from_be_bytes(bytes: &[u8]) -> Result<Self>
pub fn modulus(&self) -> &NonZero<BoxedUint>
pub fn bits_precision(&self) -> u32
pub fn residue_signed(&self, x: &SBig) -> Residue
pub fn one(&self) -> Residue
pub fn invert(&self, a: &Residue) -> Result<Residue>
Sourcepub fn pow_ct(
&self,
base: &Residue,
exp: &SBig,
exp_bits: u32,
) -> Result<Residue>
pub fn pow_ct( &self, base: &Residue, exp: &SBig, exp_bits: u32, ) -> Result<Residue>
base^exp with a secret exponent whose magnitude fits in exp_bits bits (leaked).
Negative exponents invert the base; invertibility of the base is public.
Sourcepub fn pow_vartime(&self, base: &Residue, exp: &SBig) -> Result<Residue>
pub fn pow_vartime(&self, base: &Residue, exp: &SBig) -> Result<Residue>
base^exp for public exponents.
Sourcepub fn jacobi_vartime(&self, a: &BoxedUint) -> i8
pub fn jacobi_vartime(&self, a: &BoxedUint) -> i8
Jacobi symbol (a/M) for public a (binary algorithm, variable time): −1, 0 or 1.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Modulus
impl RefUnwindSafe for Modulus
impl Send for Modulus
impl Sync for Modulus
impl Unpin for Modulus
impl UnsafeUnpin for Modulus
impl UnwindSafe for Modulus
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more