Skip to main content

OddUint

Type Alias OddUint 

Source
pub type OddUint<const LIMBS: usize> = Odd<Uint<LIMBS>>;
Expand description

Odd unsigned integer.

Aliased Type§

pub struct OddUint<const LIMBS: usize>(/* private fields */);

Implementations§

Source§

impl<const LIMBS: usize> OddUint<LIMBS>

Source

pub const fn from_be_hex(hex: &str) -> Self

Create a new OddUint from the provided big endian hex string.

§Panics
  • if the hex is malformed or not zero-padded accordingly for the size.
  • if the value is even.
Source

pub const fn from_le_hex(hex: &str) -> Self

Create a new Odd<Uint<LIMBS>> from the provided little endian hex string.

§Panics
  • if the hex is malformed or not zero-padded accordingly for the size.
  • if the value is even.
Source

pub const fn as_uint_ref(&self) -> &OddUintRef

Borrow this OddUint as a &OddUintRef.

Source

pub const fn resize<const T: usize>(&self) -> Odd<Uint<T>>

Construct an Odd<Uint<T>> from the unsigned integer value, truncating the upper bits if the value is too large to be represented.

Source§

impl<const LIMBS: usize> OddUint<LIMBS>

Source

pub const fn gcd_unsigned(&self, rhs: &Uint<LIMBS>) -> Self

Compute the greatest common divisor of self and rhs.

Source

pub const fn gcd_unsigned_vartime(&self, rhs: &Uint<LIMBS>) -> Self

Compute the greatest common divisor of self and rhs.

Executes in variable time w.r.t. all input parameters.

Source

pub const fn xgcd(&self, rhs: &Self) -> XgcdOutput<LIMBS, OddUint<LIMBS>>

Execute the Extended GCD algorithm.

Given (self, rhs), computes (g, x, y) s.t. self * x + rhs * y = g = gcd(self, rhs).

Trait Implementations§

Source§

impl<const LIMBS: usize> AsRef<Odd<UintRef>> for OddUint<LIMBS>

Source§

fn as_ref(&self) -> &OddUintRef

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<const LIMBS: usize> Gcd for OddUint<LIMBS>

Source§

type Output = Odd<Uint<LIMBS>>

Output type.
Source§

fn gcd(&self, rhs: &OddUint<LIMBS>) -> Self::Output

Compute the greatest common divisor of self and rhs.
Source§

fn gcd_vartime(&self, rhs: &OddUint<LIMBS>) -> Self::Output

Compute the greatest common divisor of self and rhs in variable time.
Source§

impl<const LIMBS: usize> Gcd<NonZero<Uint<LIMBS>>> for OddUint<LIMBS>

Source§

type Output = Odd<Uint<LIMBS>>

Output type.
Source§

fn gcd(&self, rhs: &NonZeroUint<LIMBS>) -> Self::Output

Compute the greatest common divisor of self and rhs.
Source§

fn gcd_vartime(&self, rhs: &NonZeroUint<LIMBS>) -> Self::Output

Compute the greatest common divisor of self and rhs in variable time.
Source§

impl<const LIMBS: usize> Gcd<Uint<LIMBS>> for OddUint<LIMBS>

Source§

type Output = Odd<Uint<LIMBS>>

Output type.
Source§

fn gcd(&self, rhs: &Uint<LIMBS>) -> Self::Output

Compute the greatest common divisor of self and rhs.
Source§

fn gcd_vartime(&self, rhs: &Uint<LIMBS>) -> Self::Output

Compute the greatest common divisor of self and rhs in variable time.
Source§

impl<const LIMBS: usize> Xgcd for OddUint<LIMBS>

Source§

type Output = XgcdOutput<LIMBS, Odd<Uint<LIMBS>>>

Output type.
Source§

fn xgcd(&self, rhs: &OddUint<LIMBS>) -> Self::Output

Compute the extended greatest common divisor of self and rhs.
Source§

fn xgcd_vartime(&self, rhs: &OddUint<LIMBS>) -> Self::Output

Compute the extended greatest common divisor of self and rhs in variable time.