Fp480

Struct Fp480 

Source
pub struct Fp480 { /* private fields */ }

Implementations§

Source§

impl Fp480

Source

pub fn to_monty(self) -> Monty

Source

pub fn normalize_assign_little(&mut self)

See normalize_little_limbs.

Source

pub fn normalize_little_limbs(limbs: [u32; 16]) -> [u32; 16]

This normalize should only be used when the input is at most 2*p-1.

Source

pub fn normalize_little(self) -> Self

See normalize_little_limbs.

Source

pub fn to_bytes_array(&self) -> [u8; 60]

Convert the value to a byte array which is PRIMEBYTES long. Ported from BearSSL br_i31_encode.

Source

pub fn new(digits: [u32; 16]) -> Fp480

Create a new instance given the raw limbs form. Note that this is least significant bit first.

Source

pub fn to_str_hex(&self) -> String

Source

pub fn iter_bit(&self) -> FpBitIter<'_, Fp480>

Trait Implementations§

Source§

impl Add for Fp480

Source§

type Output = Fp480

The resulting type after applying the + operator.
Source§

fn add(self, other: Fp480) -> Fp480

Performs the + operation. Read more
Source§

impl AddAssign for Fp480

Source§

fn add_assign(&mut self, other: Fp480)

Performs the += operation. Read more
Source§

impl Clone for Fp480

Source§

fn clone(&self) -> Fp480

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl ConstantSwap for Fp480

Source§

fn swap_if(&mut self, other: &mut Fp480, swap: ConstantBool<u32>)

Swaps this with other if the value was true

Source§

impl Debug for Fp480

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Fp480

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Div for Fp480

Source§

type Output = Fp480

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Fp480) -> Fp480

Performs the / operation. Read more
Source§

impl From<[u8; 64]> for Fp480

Source§

fn from(src: [u8; 64]) -> Self

Converts to this type from the input type.
Source§

impl From<[u8; 60]> for Fp480

Assume element zero is most sig

Source§

fn from(src: [u8; 60]) -> Self

Converts to this type from the input type.
Source§

impl From<u32> for Fp480

Source§

fn from(src: u32) -> Self

Converts to this type from the input type.
Source§

impl From<u64> for Fp480

Source§

fn from(src: u64) -> Self

Converts to this type from the input type.
Source§

impl From<u8> for Fp480

Source§

fn from(src: u8) -> Self

Converts to this type from the input type.
Source§

impl Inv for Fp480

Source§

type Output = Fp480

The result after applying the operator.
Source§

fn inv(self) -> Fp480

Returns the multiplicative inverse of self. Read more
Source§

impl LowerHex for Fp480

Prints the hex value of the number in big endian (most significant digit on the left and least on the right) to make debugging easier.

Source§

fn fmt(&self, fmtr: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Mul<Fp480> for Monty

Source§

type Output = Fp480

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Fp480) -> Fp480

Performs the * operation. Read more
Source§

impl Mul<Monty> for Fp480

Source§

type Output = Fp480

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Monty) -> Fp480

Performs the * operation. Read more
Source§

impl Mul<u32> for Fp480

Note that this reveals the u32, but nothing else. It’s expected that the u32 is not secret. If it is, you can use Mul<$classname>

Source§

type Output = Fp480

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: u32) -> Fp480

Performs the * operation. Read more
Source§

impl Mul for Fp480

Source§

type Output = Fp480

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Fp480) -> Fp480

Performs the * operation. Read more
Source§

impl MulAssign for Fp480

Note that this uses a conversion to montgomery form and then multiplies by the other value to get back out. This takes less time than just doing the multiplication and doing a reduction.

Source§

fn mul_assign(&mut self, rhs: Fp480)

Performs the *= operation. Read more
Source§

impl Neg for Fp480

Source§

type Output = Fp480

The resulting type after applying the - operator.
Source§

fn neg(self) -> Fp480

Performs the unary - operation. Read more
Source§

impl One for Fp480

Source§

fn one() -> Self

Returns the multiplicative identity element of Self, 1. Read more
Source§

fn is_one(&self) -> bool

Returns true if self is equal to the multiplicative identity. Read more
Source§

fn set_one(&mut self)

Sets self to the multiplicative identity element of Self, 1.
Source§

impl Ord for Fp480

Source§

fn cmp(&self, other: &Fp480) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Fp480

Source§

fn eq(&self, other: &Fp480) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Fp480

Source§

fn partial_cmp(&self, other: &Fp480) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Pow<Fp480> for Fp480

Source§

fn pow(self, rhs: Fp480) -> Fp480

14.94 Algorithm Montgomery exponentiation in Handbook of Applied Crypto INPUT:m=(ml−1···m0)b,R=bl,m′ =−m−1 modb,e=(et···e0)2 withet =1, and an integer x, 1 ≤ x < m. OUTPUT: xe mod m.

  1. x􏰁← Mont(x,R2 mod m), A←R mod m. (R mod m and R2 mod m may be pro-ided as inputs.)
  2. For i from t down to 0 do the following: 2.1 A←Mont(A,A). 2.2 If ei = 1 then A← Mont(A, x􏰁).
  3. A←Mont(A,1).
  4. Return(A).
Source§

type Output = Fp480

The result after applying the operator.
Source§

impl Pow<u32> for Fp480

Reveals the exponent. If you need constant time, use Pow<$classname>

Source§

type Output = Fp480

The result after applying the operator.
Source§

fn pow(self, rhs: u32) -> Fp480

Returns self to the power rhs. Read more
Source§

impl Sub for Fp480

Source§

type Output = Fp480

The resulting type after applying the - operator.
Source§

fn sub(self, other: Fp480) -> Fp480

Performs the - operation. Read more
Source§

impl SubAssign for Fp480

Source§

fn sub_assign(&mut self, other: Fp480)

Performs the -= operation. Read more
Source§

impl Zero for Fp480

Source§

fn zero() -> Self

Returns the additive identity element of Self, 0. Read more
Source§

fn is_zero(&self) -> bool

Returns true if self is equal to the additive identity.
Source§

fn set_zero(&mut self)

Sets self to the additive identity element of Self, 0.
Source§

impl Copy for Fp480

Source§

impl Eq for Fp480

Source§

impl StructuralPartialEq for Fp480

Auto Trait Implementations§

§

impl Freeze for Fp480

§

impl RefUnwindSafe for Fp480

§

impl Send for Fp480

§

impl Sync for Fp480

§

impl Unpin for Fp480

§

impl UnwindSafe for Fp480

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.