pub struct HALF_PRIME { /* private fields */ }
Methods from Deref<Target = Felt>§
pub const ZERO: Felt
pub const ONE: Felt
pub const TWO: Felt
pub const THREE: Felt
pub const MAX: Felt
pub const ELEMENT_UPPER_BOUND: Felt
Sourcepub fn to_bytes_be(&self) -> [u8; 32]
pub fn to_bytes_be(&self) -> [u8; 32]
Converts to big-endian byte representation in a u8 array. This is as performant as to_bytes_le
Sourcepub fn to_bytes_le(&self) -> [u8; 32]
pub fn to_bytes_le(&self) -> [u8; 32]
Converts to little-endian byte representation in a u8 array. This is as performant as to_bytes_be
Sourcepub fn to_hex_string(&self) -> String
pub fn to_hex_string(&self) -> String
Helper to produce a hexadecimal formatted string.
Equivalent to calling format!("{self:#x}")
.
Sourcepub fn to_fixed_hex_string(&self) -> String
pub fn to_fixed_hex_string(&self) -> String
Helper to produce a hexadecimal formatted string of 66 chars.
Sourcepub fn to_bits_le(&self) -> [bool; 256]
pub fn to_bits_le(&self) -> [bool; 256]
Converts to little-endian bit representation.
Sourcepub fn to_bits_be(&self) -> [bool; 256]
pub fn to_bits_be(&self) -> [bool; 256]
Converts to big-endian bit representation.
Sourcepub fn field_div(&self, rhs: &NonZeroFelt) -> Felt
pub fn field_div(&self, rhs: &NonZeroFelt) -> Felt
Finite field division.
Sourcepub fn floor_div(&self, rhs: &NonZeroFelt) -> Felt
pub fn floor_div(&self, rhs: &NonZeroFelt) -> Felt
Truncated quotient between self
and rhs
.
Sourcepub fn div_rem(&self, rhs: &NonZeroFelt) -> (Felt, Felt)
pub fn div_rem(&self, rhs: &NonZeroFelt) -> (Felt, Felt)
Quotient and remainder between self
and rhs
.
Sourcepub fn sqrt(&self) -> Option<Felt>
pub fn sqrt(&self) -> Option<Felt>
Finds the square root. There may be 2 roots for each square, and the lower one is returned.
Sourcepub fn mul_mod(&self, rhs: &Felt, p: &NonZeroFelt) -> Felt
pub fn mul_mod(&self, rhs: &Felt, p: &NonZeroFelt) -> Felt
Modular multiplication between self
and rhs
in modulo p
.
Sourcepub fn mod_inverse(&self, p: &NonZeroFelt) -> Option<Felt>
pub fn mod_inverse(&self, p: &NonZeroFelt) -> Option<Felt>
Multiplicative inverse of self
in modulo p
.
Sourcepub fn mod_floor(&self, n: &NonZeroFelt) -> Felt
pub fn mod_floor(&self, n: &NonZeroFelt) -> Felt
Remainder of dividing self
by n
as integers.
Sourcepub fn to_raw_reversed(&self) -> [u64; 4]
pub fn to_raw_reversed(&self) -> [u64; 4]
Returns the internal representation of a felt and reverses it to match starknet-rs mont representation
Sourcepub fn to_le_digits(&self) -> [u64; 4]
pub fn to_le_digits(&self) -> [u64; 4]
Convert self
’s representative into an array of u64
digits,
least significant digits first.
Sourcepub fn to_be_digits(&self) -> [u64; 4]
pub fn to_be_digits(&self) -> [u64; 4]
Convert self
’s representative into an array of u64
digits,
most significant digits first.
Sourcepub fn bits(&self) -> usize
pub fn bits(&self) -> usize
Count the minimum number of bits needed to express self
’s representative.
pub fn to_biguint(&self) -> BigUint
pub fn to_bigint(&self) -> BigInt
Trait Implementations§
Source§impl Deref for HALF_PRIME
impl Deref for HALF_PRIME
impl LazyStatic for HALF_PRIME
Auto Trait Implementations§
impl Freeze for HALF_PRIME
impl RefUnwindSafe for HALF_PRIME
impl Send for HALF_PRIME
impl Sync for HALF_PRIME
impl Unpin for HALF_PRIME
impl UnwindSafe for HALF_PRIME
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more