[][src]Struct gridiron::fp_256::Fp256

pub struct Fp256 { /* fields omitted */ }

Methods

impl Fp256[src]

pub fn to_monty(self) -> Monty[src]

pub fn normalize_assign_little(&mut self)[src]

See normalize_little_limbs.

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

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

pub fn normalize_little(self) -> Self[src]

See normalize_little_limbs.

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

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

pub fn new(digits: [u32; 9]) -> Fp256[src]

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

pub fn to_str_hex(&self) -> String[src]

Important traits for FpBitIter<'a, Fp256>
pub fn iter_bit(&self) -> FpBitIter<Fp256>[src]

Trait Implementations

impl ConstantSwap for Fp256[src]

fn swap_if(&mut self, other: &mut Fp256, swap: ConstantBool<u32>)[src]

Swaps this with other if the value was true

impl Eq for Fp256[src]

impl Clone for Fp256[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Copy for Fp256[src]

impl PartialOrd<Fp256> for Fp256[src]

#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests less than (for self and other) and is used by the < operator. Read more

#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl PartialEq<Fp256> for Fp256[src]

impl Default for Fp256[src]

impl Ord for Fp256[src]

fn max(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the maximum of two values. Read more

fn min(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the minimum of two values. Read more

impl From<u8> for Fp256[src]

impl From<u32> for Fp256[src]

impl From<u64> for Fp256[src]

impl From<[u8; 32]> for Fp256[src]

Assume element zero is most sig

impl From<[u8; 64]> for Fp256[src]

impl Add<Fp256> for Fp256[src]

type Output = Fp256

The resulting type after applying the + operator.

impl Sub<Fp256> for Fp256[src]

type Output = Fp256

The resulting type after applying the - operator.

impl Mul<Fp256> for Fp256[src]

type Output = Fp256

The resulting type after applying the * operator.

impl Mul<u32> for Fp256[src]

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>

type Output = Fp256

The resulting type after applying the * operator.

impl Mul<Fp256> for Monty[src]

type Output = Fp256

The resulting type after applying the * operator.

impl Mul<Monty> for Fp256[src]

type Output = Fp256

The resulting type after applying the * operator.

impl Div<Fp256> for Fp256[src]

type Output = Fp256

The resulting type after applying the / operator.

impl Neg for Fp256[src]

type Output = Fp256

The resulting type after applying the - operator.

impl AddAssign<Fp256> for Fp256[src]

impl SubAssign<Fp256> for Fp256[src]

impl MulAssign<Fp256> for Fp256[src]

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.

impl Debug for Fp256[src]

impl LowerHex for Fp256[src]

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.

impl Zero for Fp256[src]

impl One for Fp256[src]

impl Inv for Fp256[src]

type Output = Fp256

The result after applying the operator.

impl Pow<u32> for Fp256[src]

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

type Output = Fp256

The result after applying the operator.

impl Pow<Fp256> for Fp256[src]

type Output = Fp256

The result after applying the operator.

fn pow(self, rhs: Fp256) -> Fp256[src]

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).

Auto Trait Implementations

impl Send for Fp256

impl Sync for Fp256

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]