pub(crate) trait Limbs:
Clone
+ AsRef<[Limb]>
+ AsMut<[Limb]>
+ CtEq
+ CtAssign
+ LimbHelpers {
type Wide: WideLimbs<Self>;
// Required methods
fn xgcd(self, other: Self) -> Xgcd<Self>;
fn div(self, denom: &Self) -> Self;
fn mul(&self, other: &Self) -> Self::Wide;
// Provided methods
fn mul_mod(&self, other: &Self, modulus: &Self) -> Self { ... }
fn square(&self) -> Self::Wide { ... }
}Expand description
The required view over a collection of limbs to calculate the c coefficient.
Implementations MUST implement all functions in time constant to the value of the inputs, except for the amount of limbs, unless otherwise stated. Implementations MUST NOT panic for any input which the caller MAY pass.
Required Associated Types§
Required Methods§
Sourcefn xgcd(self, other: Self) -> Xgcd<Self>
fn xgcd(self, other: Self) -> Xgcd<Self>
Calculate the GCD d of self, other (as a, b) and the coefficients such that
ua + vb = d.
Callers MUST ensure the inputs have the same amount of limbs. Callers MUST NOT pass
a = 0 or b = 0.
Implementations MUST return values with the same amount of limbs as the inputs.
Provided Methods§
Sourcefn mul_mod(&self, other: &Self, modulus: &Self) -> Self
fn mul_mod(&self, other: &Self, modulus: &Self) -> Self
Multiply two values modulo modulus.
Callers MUST ensure the inputs have the same amount of limbs. Callers MUST NOT pass
modulus = 0.
Implementations MUST support any factors, not just those less than the modulus. Implementations MUST return a value with the same amount of limbs as the modulus.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".