pub struct ModInverseHint;Expand description
ModInverse hint implementation
Implementations§
Source§impl ModInverseHint
impl ModInverseHint
pub const fn new() -> Self
Sourcepub fn call(
builder: &CircuitBuilder,
base: &[Wire],
modulus: &[Wire],
) -> (Vec<Wire>, Vec<Wire>)
pub fn call( builder: &CircuitBuilder, base: &[Wire], modulus: &[Wire], ) -> (Vec<Wire>, Vec<Wire>)
Modular inverse.
Computes the modular inverse of base modulo modulus.
Returns a pair (quotient, inverse) where both numbers are Bézout coefficients when
base and modulus are coprime. Both numbers are set to zero if gcd(base, modulus) > 1.
This is a hint - a deterministic computation that happens only on the prover side.
The result should be additionally constrained by using bignum circuits to check that
base * inverse = 1 + quotient * modulus.
Trait Implementations§
Source§impl Default for ModInverseHint
impl Default for ModInverseHint
Source§impl Hint for ModInverseHint
impl Hint for ModInverseHint
Auto Trait Implementations§
impl Freeze for ModInverseHint
impl RefUnwindSafe for ModInverseHint
impl Send for ModInverseHint
impl Sync for ModInverseHint
impl Unpin for ModInverseHint
impl UnsafeUnpin for ModInverseHint
impl UnwindSafe for ModInverseHint
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more