pub struct Gcd<'a> { /* private fields */ }Expand description
Given BinaryBundles a and b, output GCD(a, b).
Implementations§
Source§impl<'a> Gcd<'a>
impl<'a> Gcd<'a>
Sourcepub fn new(upper_bound: usize) -> Self
pub fn new(upper_bound: usize) -> Self
Create a new Gcd circuit using a fixed upper bound.
Since the circuit needs to be oblivious, we cannot terminate the GCD
algorithm by conditioning on the values of a or b as is the case in
the “standard” version of GCD. Instead, we rely on an upper bound on the
number of iterations we know the algorithm will terminate by. The
Euclidean algorithm based on subtractions will take no more than N steps
where N is the larger of the two numbers we are computing the GCD for.
Trait Implementations§
Source§impl<'a, F: FancyBinary> Circuit<F> for Gcd<'a>where
F::Item: 'a,
impl<'a, F: FancyBinary> Circuit<F> for Gcd<'a>where
F::Item: 'a,
Source§type Input = (&'a BinaryBundle<<F as Fancy>::Item>, &'a BinaryBundle<<F as Fancy>::Item>)
type Input = (&'a BinaryBundle<<F as Fancy>::Item>, &'a BinaryBundle<<F as Fancy>::Item>)
The input type of the circuit.
Auto Trait Implementations§
impl<'a> Freeze for Gcd<'a>
impl<'a> RefUnwindSafe for Gcd<'a>
impl<'a> Send for Gcd<'a>
impl<'a> Sync for Gcd<'a>
impl<'a> Unpin for Gcd<'a>
impl<'a> UnsafeUnpin for Gcd<'a>
impl<'a> UnwindSafe for Gcd<'a>
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
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§impl<T> IsSameType<T> for T
impl<T> IsSameType<T> for T
§type EqualityProposition = TrueEqualityProposition
type EqualityProposition = TrueEqualityProposition
The [
EqualityProposition] that Self == T