pub struct BFieldElement(_);

Implementations§

source§

impl BFieldElement

source

pub const BYTES: usize = 8usize

source

pub const P: u64 = 18_446_744_069_414_584_321u64

source

pub const MAX: u64 = 18_446_744_069_414_584_320u64

source

pub const fn new(value: u64) -> Self

source

pub const fn value(&self) -> u64

source

pub const fn power_accumulator<const N: usize, const M: usize>( base: [Self; N], tail: [Self; N] ) -> [Self; N]

Square the base M times and multiply the result by the tail value

source

pub const fn generator() -> Self

Get a generator for the entire field

source

pub const fn lift(&self) -> XFieldElement

source

pub fn increment(&mut self)

source

pub fn decrement(&mut self)

source

pub const fn mod_pow(&self, exp: u64) -> Self

source

pub fn from_ne_bytes(bytes: &[u8]) -> BFieldElement

Convert a BFieldElement from a byte slice in native endianness.

source

pub const fn montyred(x: u128) -> u64

Montgomery reduction

source

pub const fn raw_bytes(&self) -> [u8; 8]

Return the raw bytes or 8-bit chunks of the Montgomery representation, in little-endian byte order

source

pub const fn from_raw_bytes(bytes: &[u8; 8]) -> Self

Take a slice of 8 bytes and interpret it as an integer in little-endian byte order, and cast it to a BFieldElement in Montgomery representation

source

pub const fn raw_u16s(&self) -> [u16; 4]

Return the raw 16-bit chunks of the Montgomery representation, in little-endian chunk order

source

pub const fn from_raw_u16s(chunks: &[u16; 4]) -> Self

Take a slice of 4 16-bit chunks and interpret it as an integer in little-endian chunk order, and cast it to a BFieldElement in Montgomery representation

source

pub fn raw_u128(&self) -> u128

source

pub const fn from_raw_u64(e: u64) -> BFieldElement

source

pub fn raw_u64(&self) -> u64

Trait Implementations§

source§

impl Add<BFieldElement> for BFieldElement

§

type Output = BFieldElement

The resulting type after applying the + operator.
source§

fn add(self, rhs: Self) -> Self

Performs the + operation. Read more
source§

impl Add<BFieldElement> for XFieldElement

§

type Output = XFieldElement

The resulting type after applying the + operator.
source§

fn add(self, other: BFieldElement) -> Self

Performs the + operation. Read more
source§

impl Add<XFieldElement> for BFieldElement

The bfe + xfe -> xfe instance belongs to BFieldElement.

§

type Output = XFieldElement

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl AddAssign<BFieldElement> for BFieldElement

source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
source§

impl AddAssign<BFieldElement> for XFieldElement

source§

fn add_assign(&mut self, rhs: BFieldElement)

Performs the += operation. Read more
source§

impl BFieldCodec for BFieldElement

source§

fn decode(sequence: &[BFieldElement]) -> Result<Box<Self>>

source§

fn encode(&self) -> Vec<BFieldElement>

source§

fn static_length() -> Option<usize>

Returns the length in number of BFieldElements if it is known at compile-time. Otherwise, None.
source§

impl Clone for BFieldElement

source§

fn clone(&self) -> BFieldElement

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 CyclicGroupGenerator for BFieldElement

source§

impl Debug for BFieldElement

source§

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

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

impl Default for BFieldElement

source§

fn default() -> BFieldElement

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

impl<'de> Deserialize<'de> for BFieldElement

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Display for BFieldElement

source§

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

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

impl Distribution<BFieldElement> for Standard

source§

fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> BFieldElement

Generate a random value of T, using rng as the source of randomness.
source§

fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>where R: Rng, Self: Sized,

Create an iterator that generates random values of T, using rng as the source of randomness. Read more
source§

fn map<F, S>(self, func: F) -> DistMap<Self, F, T, S>where F: Fn(T) -> S, Self: Sized,

Create a distribution of values of ‘S’ by mapping the output of Self through the closure F Read more
source§

impl Div<BFieldElement> for BFieldElement

§

type Output = BFieldElement

The resulting type after applying the / operator.
source§

fn div(self, other: Self) -> Self

Performs the / operation. Read more
source§

impl Emojihash for BFieldElement

source§

impl FiniteField for BFieldElement

source§

fn batch_inversion(input: Vec<Self>) -> Vec<Self>

Montgomery Batch Inversion
source§

fn square(self) -> Self

source§

impl From<&BFieldElement> for u64

source§

fn from(elem: &BFieldElement) -> Self

Converts to this type from the input type.
source§

impl From<[u8; 8]> for BFieldElement

source§

fn from(array: [u8; 8]) -> Self

Converts to this type from the input type.
source§

impl From<BFieldElement> for [u8; 8]

Convert a B-field element to a byte array. The client uses this for its database.

source§

fn from(bfe: BFieldElement) -> Self

Converts to this type from the input type.
source§

impl From<BFieldElement> for XFieldElement

source§

fn from(bfe: BFieldElement) -> Self

Converts to this type from the input type.
source§

impl From<BFieldElement> for u64

source§

fn from(elem: BFieldElement) -> Self

Converts to this type from the input type.
source§

impl From<u32> for BFieldElement

source§

fn from(value: u32) -> Self

Converts to this type from the input type.
source§

impl From<u64> for BFieldElement

source§

fn from(value: u64) -> Self

Converts to this type from the input type.
source§

impl FromVecu8 for BFieldElement

source§

fn from_vecu8(bytes: Vec<u8>) -> Self

source§

impl GetSize for BFieldElement

source§

fn get_stack_size() -> usize

Determines how may bytes this object occupies inside the stack. Read more
source§

fn get_heap_size(&self) -> usize

Determines how many bytes this object occupies inside the heap. Read more
source§

fn get_size(&self) -> usize

Determines the total size of the object. Read more
source§

impl Hash for BFieldElement

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl Inverse for BFieldElement

source§

fn inverse(&self) -> Self

source§

fn inverse_or_zero(&self) -> Self

source§

impl ModPowU32 for BFieldElement

source§

fn mod_pow_u32(&self, exp: u32) -> Self

source§

impl ModPowU64 for BFieldElement

source§

fn mod_pow_u64(&self, pow: u64) -> Self

source§

impl Mul<BFieldElement> for BFieldElement

§

type Output = BFieldElement

The resulting type after applying the * operator.
source§

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

Performs the * operation. Read more
source§

impl Mul<BFieldElement> for XFieldElement

XField * BField means scalar multiplication of the BFieldElement onto each coefficient of the XField.

§

type Output = XFieldElement

The resulting type after applying the * operator.
source§

fn mul(self, other: BFieldElement) -> Self

Performs the * operation. Read more
source§

impl Mul<XFieldElement> for BFieldElement

§

type Output = XFieldElement

The resulting type after applying the * operator.
source§

fn mul(self, other: XFieldElement) -> XFieldElement

Performs the * operation. Read more
source§

impl MulAssign<BFieldElement> for BFieldElement

source§

fn mul_assign(&mut self, rhs: Self)

Performs the *= operation. Read more
source§

impl MulAssign<BFieldElement> for XFieldElement

source§

fn mul_assign(&mut self, rhs: BFieldElement)

Performs the *= operation. Read more
source§

impl Neg for BFieldElement

§

type Output = BFieldElement

The resulting type after applying the - operator.
source§

fn neg(self) -> Self

Performs the unary - operation. Read more
source§

impl New for BFieldElement

source§

fn new_from_usize(&self, value: usize) -> Self

source§

impl One for BFieldElement

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 PartialEq<BFieldElement> for BFieldElement

source§

fn eq(&self, other: &BFieldElement) -> 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 PrimitiveRootOfUnity for BFieldElement

source§

impl Serialize for BFieldElement

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Sub<BFieldElement> for BFieldElement

§

type Output = BFieldElement

The resulting type after applying the - operator.
source§

fn sub(self, rhs: Self) -> Self

Performs the - operation. Read more
source§

impl Sub<BFieldElement> for XFieldElement

Subtracting a BFieldElement from an XFieldElement

self - other = self + (-other)

This overloads to Add and Neg

§

type Output = XFieldElement

The resulting type after applying the - operator.
source§

fn sub(self, other: BFieldElement) -> Self

Performs the - operation. Read more
source§

impl Sub<XFieldElement> for BFieldElement

§

type Output = XFieldElement

The resulting type after applying the - operator.
source§

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

Performs the - operation. Read more
source§

impl SubAssign<BFieldElement> for BFieldElement

source§

fn sub_assign(&mut self, rhs: Self)

Performs the -= operation. Read more
source§

impl SubAssign<BFieldElement> for XFieldElement

source§

fn sub_assign(&mut self, rhs: BFieldElement)

Performs the -= operation. Read more
source§

impl Sum<BFieldElement> for BFieldElement

source§

fn sum<I: Iterator<Item = Self>>(iter: I) -> Self

Method which takes an iterator and generates Self from the elements by “summing up” the items.
source§

impl TryFrom<BFieldElement> for u32

§

type Error = TryFromIntError

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

fn try_from(value: BFieldElement) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl Zero for BFieldElement

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 BFieldElement

source§

impl Eq for BFieldElement

source§

impl StructuralEq for BFieldElement

source§

impl StructuralPartialEq for BFieldElement

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<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. 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.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

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> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
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.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,