Struct salty::FieldElement

source ·
pub struct FieldElement(pub [i64; 16]);
Expand description

Element of the base field of the elliptic curve

Tuple Fields§

§0: [i64; 16]

Trait Implementations§

source§

impl<'a, 'b> Add<&'b FieldElement> for &'a FieldElement

source§

fn add(self, other: &'b FieldElement) -> FieldElement

Addition of field elements

§

type Output = FieldElement

The resulting type after applying the + operator.
source§

impl<'b> AddAssign<&'b FieldElement> for FieldElement

source§

fn add_assign(&mut self, other: &'b FieldElement)

Performs the += operation. Read more
source§

impl Clone for FieldElement

source§

fn clone(&self) -> FieldElement

Returns a copy 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 ConditionallySelectable for FieldElement

source§

fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self

Select a or b according to choice. Read more
source§

fn conditional_swap(a: &mut Self, b: &mut Self, choice: Choice)

Conditionally swap self and other if choice == 1; otherwise, reassign both unto themselves. Read more
source§

fn conditional_assign(&mut self, other: &Self, choice: Choice)

Conditionally assign other to self, according to choice. Read more
source§

impl ConstantTimeEq for FieldElement

source§

fn ct_eq(&self, other: &Self) -> Choice

Determine if two items are equal. Read more
source§

fn ct_ne(&self, other: &Self) -> Choice

Determine if two items are NOT equal. Read more
source§

impl Debug for FieldElement

source§

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

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

impl Default for FieldElement

source§

fn default() -> FieldElement

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

impl FieldImplementation for FieldElement

source§

fn pow2523(&self) -> FieldElement

TODO: figure out why this doesn’t pass the test at the end

§

type Limbs = [i64; 16]

Internal representation as limbs
source§

const ZERO: Self = _

source§

const ONE: Self = _

source§

const D: Self = _

source§

const D2: Self = _

source§

const EDWARDS_BASEPOINT_X: Self = _

source§

const EDWARDS_BASEPOINT_Y: Self = _

source§

const I: Self = _

source§

const APLUS2_OVER_FOUR: Self = _

source§

const MONTGOMERY_BASEPOINT_U: Self = _

source§

fn to_bytes(&self) -> [u8; 32]

to canonical representation as little-endian bytes
source§

fn from_bytes_unchecked(bytes: &[u8; 32]) -> FieldElement

construct from canonical representation as little-endian bytes
source§

fn inverse(&self) -> FieldElement

source§

fn from_unreduced_bytes(bytes: &[u8; 32]) -> Self

construct from possibly non-canonical representation as little-endian bytes
source§

fn from_bytes(bytes: &[u8; 32]) -> Result<Self>

construct from canonical representation as little-endian bytes, with validity check
source§

fn parity(&self) -> u8

parity of field element, viewed as integer modulo 2**255 - 19
source§

fn squared(&self) -> Self

default implementation, actual implementation may override this with a faster version
source§

impl<'a, 'b> Mul<&'b FieldElement> for &'a FieldElement

§

type Output = FieldElement

The resulting type after applying the * operator.
source§

fn mul(self, other: &'b FieldElement) -> FieldElement

Performs the * operation. Read more
source§

impl<'b> MulAssign<&'b FieldElement> for FieldElement

source§

fn mul_assign(&mut self, other: &'b FieldElement)

Performs the *= operation. Read more
source§

impl<'a> Neg for &'a FieldElement

source§

fn neg(self) -> FieldElement

Subition of field elements

§

type Output = FieldElement

The resulting type after applying the - operator.
source§

impl PartialEq for FieldElement

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a, 'b> Sub<&'b FieldElement> for &'a FieldElement

source§

fn sub(self, other: &'b FieldElement) -> FieldElement

Subition of field elements

§

type Output = FieldElement

The resulting type after applying the - operator.
source§

impl<'b> SubAssign<&'b FieldElement> for FieldElement

source§

fn sub_assign(&mut self, other: &'b FieldElement)

Performs the -= operation. Read more
source§

impl Zeroize for FieldElement

source§

fn zeroize(&mut self)

Zero out this object from memory using Rust intrinsics which ensure the zeroization operation is not “optimized away” by the compiler.
source§

impl Copy for FieldElement

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> ConditionallyNegatable for Twhere T: ConditionallySelectable, &'a T: for<'a> Neg<Output = T>,

source§

fn conditional_negate(&mut self, choice: Choice)

Negate self if choice == Choice(1); otherwise, leave it unchanged. 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 Twhere 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, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.