Type Alias Scalar

Source
pub type Scalar = Bn254Scalar;

Aliased Type§

struct Scalar(/* private fields */);

Implementations

Source§

impl Bn254Scalar

Source

pub const fn from_const_bytes(bytes: [u8; 32]) -> Self

Constructor from little-endian bytes. Does not enforce the integer value of bytes must be less than the modulus.

Trait Implementations§

Source§

impl Field for Scalar

Source§

const ZERO: Self = <Self as IntMod>::ZERO

The zero element of the field, the additive identity.
Source§

const ONE: Self = <Self as IntMod>::ONE

The one element of the field, the multiplicative identity.
Source§

type SelfRef<'a> = &'a Bn254Scalar

Source§

fn double_assign(&mut self)

Doubles self in-place.
Source§

fn square_assign(&mut self)

Square self in-place
Source§

fn invert(&self) -> Self

Unchecked inversion. See DivUnsafe. Read more
Source§

impl<'a> Add<&'a Bn254Scalar> for Bn254Scalar

Source§

type Output = Bn254Scalar

The resulting type after applying the + operator.
Source§

fn add(self, other: &'a Bn254Scalar) -> Self::Output

Performs the + operation. Read more
Source§

impl Add for Bn254Scalar

Source§

type Output = Bn254Scalar

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl<'a> AddAssign<&'a Bn254Scalar> for Bn254Scalar

Source§

fn add_assign(&mut self, other: &'a Bn254Scalar)

Performs the += operation. Read more
Source§

impl AddAssign for Bn254Scalar

Source§

fn add_assign(&mut self, other: Self)

Performs the += operation. Read more
Source§

impl Clone for Bn254Scalar

Source§

fn clone(&self) -> Bn254Scalar

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 Debug for Bn254Scalar

Source§

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

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

impl<'de> Deserialize<'de> for Bn254Scalar

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<'a> DivAssignUnsafe<&'a Bn254Scalar> for Bn254Scalar

Source§

fn div_assign_unsafe(&mut self, other: &'a Bn254Scalar)

Undefined behaviour when denominator is not coprime to N

Source§

impl DivAssignUnsafe for Bn254Scalar

Source§

fn div_assign_unsafe(&mut self, other: Self)

Undefined behaviour when denominator is not coprime to N

Source§

impl<'a> DivUnsafe<&'a Bn254Scalar> for Bn254Scalar

Source§

fn div_unsafe(self, other: &'a Bn254Scalar) -> Self::Output

Undefined behaviour when denominator is not coprime to N

Source§

type Output = Bn254Scalar

Output type of div_unsafe.
Source§

impl DivUnsafe for Bn254Scalar

Source§

fn div_unsafe(self, other: Self) -> Self::Output

Undefined behaviour when denominator is not coprime to N

Source§

type Output = Bn254Scalar

Output type of div_unsafe.
Source§

impl IntMod for Bn254Scalar

Source§

fn assert_reduced(&self)

If self is not in its canonical form, the proof will fail to verify. This means guest execution will never terminate (either successfully or unsuccessfully) if self is not in its canonical form.

Source§

const MODULUS: Self::Repr

Modulus as a Repr.
Source§

const ZERO: Self

The zero element (i.e. the additive identity).
Source§

const NUM_LIMBS: usize = 32usize

Number of limbs used to internally represent an element of Self.
Source§

const ONE: Self

The one element (i.e. the multiplicative identity).
Source§

type Repr = [u8; 32]

Underlying representation of IntMod. Usually of the form [u8; NUM_LIMBS].
Source§

type SelfRef<'a> = &'a Bn254Scalar

SelfRef<'a> should almost always be &'a Self. This is a way to include implementations of binary operations where both sides are &'a Self.
Source§

fn from_repr(repr: Self::Repr) -> Self

Creates a new IntMod from an instance of Repr. Does not enforce the integer value of bytes must be less than the modulus.
Source§

fn from_le_bytes(bytes: &[u8]) -> Self

Creates a new IntMod from an array of bytes, little endian. Does not enforce the integer value of bytes must be less than the modulus.
Source§

fn from_be_bytes(bytes: &[u8]) -> Self

Creates a new IntMod from an array of bytes, big endian. Does not enforce the integer value of bytes must be less than the modulus.
Source§

fn from_u8(val: u8) -> Self

Creates a new IntMod from a u8. Does not enforce the integer value of bytes must be less than the modulus.
Source§

fn from_u32(val: u32) -> Self

Creates a new IntMod from a u32. Does not enforce the integer value of bytes must be less than the modulus.
Source§

fn from_u64(val: u64) -> Self

Creates a new IntMod from a u64. Does not enforce the integer value of bytes must be less than the modulus.
Source§

fn as_le_bytes(&self) -> &[u8]

Value of this IntMod as an array of bytes, little endian.
Source§

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

Value of this IntMod as an array of bytes, big endian.
Source§

fn modulus_biguint() -> BigUint

Modulus N as a BigUint.
Source§

fn from_biguint(biguint: BigUint) -> Self

Creates a new IntMod from a BigUint.
Source§

fn as_biguint(&self) -> BigUint

Value of this IntMod as a BigUint.
Source§

fn neg_assign(&mut self)

Source§

fn double_assign(&mut self)

Doubles self in-place.
Source§

fn square_assign(&mut self)

Squares self in-place.
Source§

fn double(&self) -> Self

Doubles this IntMod.
Source§

fn square(&self) -> Self

Squares this IntMod.
Source§

fn cube(&self) -> Self

Cubes this IntMod.
Source§

fn is_reduced(&self) -> bool

Is the integer representation of self less than the modulus?
Source§

impl<'a> Mul<&'a Bn254Scalar> for Bn254Scalar

Source§

type Output = Bn254Scalar

The resulting type after applying the * operator.
Source§

fn mul(self, other: &'a Bn254Scalar) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul for Bn254Scalar

Source§

type Output = Bn254Scalar

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl<'a> MulAssign<&'a Bn254Scalar> for Bn254Scalar

Source§

fn mul_assign(&mut self, other: &'a Bn254Scalar)

Performs the *= operation. Read more
Source§

impl MulAssign for Bn254Scalar

Source§

fn mul_assign(&mut self, other: Self)

Performs the *= operation. Read more
Source§

impl Neg for Bn254Scalar

Source§

type Output = Bn254Scalar

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl PartialEq for Bn254Scalar

Source§

fn eq(&self, other: &Self) -> 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<'a> Product<&'a Bn254Scalar> for Bn254Scalar

Source§

fn product<I: Iterator<Item = &'a Bn254Scalar>>(iter: I) -> Self

Takes an iterator and generates Self from the elements by multiplying the items.
Source§

impl Product for Bn254Scalar

Source§

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

Takes an iterator and generates Self from the elements by multiplying the items.
Source§

impl Reduce for Bn254Scalar

Source§

fn reduce_le_bytes(bytes: &[u8]) -> Self

Interpret the given bytes as an integer and perform a modular reduction.
Source§

fn reduce_be_bytes(bytes: &[u8]) -> Self

Source§

impl Serialize for Bn254Scalar

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<'a> Sub<&'a Bn254Scalar> for Bn254Scalar

Source§

type Output = Bn254Scalar

The resulting type after applying the - operator.
Source§

fn sub(self, other: &'a Bn254Scalar) -> Self::Output

Performs the - operation. Read more
Source§

impl Sub for Bn254Scalar

Source§

type Output = Bn254Scalar

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl<'a> SubAssign<&'a Bn254Scalar> for Bn254Scalar

Source§

fn sub_assign(&mut self, other: &'a Bn254Scalar)

Performs the -= operation. Read more
Source§

impl SubAssign for Bn254Scalar

Source§

fn sub_assign(&mut self, other: Self)

Performs the -= operation. Read more
Source§

impl<'a> Sum<&'a Bn254Scalar> for Bn254Scalar

Source§

fn sum<I: Iterator<Item = &'a Bn254Scalar>>(iter: I) -> Self

Takes an iterator and generates Self from the elements by “summing up” the items.
Source§

impl Sum for Bn254Scalar

Source§

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

Takes an iterator and generates Self from the elements by “summing up” the items.
Source§

impl Eq for Bn254Scalar