pub type Scalar = Bn254Scalar;
Aliased Type§
struct Scalar(/* private fields */);
Implementations
Source§impl Bn254Scalar
impl Bn254Scalar
Sourcepub const fn from_const_bytes(bytes: [u8; 32]) -> Self
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
impl Field for Scalar
Source§const ZERO: Self = <Self as IntMod>::ZERO
const ZERO: Self = <Self as IntMod>::ZERO
The zero element of the field, the additive identity.
Source§const ONE: Self = <Self as IntMod>::ONE
const ONE: Self = <Self as IntMod>::ONE
The one element of the field, the multiplicative identity.
type SelfRef<'a> = &'a Bn254Scalar
Source§fn double_assign(&mut self)
fn double_assign(&mut self)
Doubles
self
in-place.Source§fn square_assign(&mut self)
fn square_assign(&mut self)
Square
self
in-placeSource§impl<'a> Add<&'a Bn254Scalar> for Bn254Scalar
impl<'a> Add<&'a Bn254Scalar> for Bn254Scalar
Source§type Output = Bn254Scalar
type Output = Bn254Scalar
The resulting type after applying the
+
operator.Source§impl Add for Bn254Scalar
impl Add for Bn254Scalar
Source§impl<'a> AddAssign<&'a Bn254Scalar> for Bn254Scalar
impl<'a> AddAssign<&'a Bn254Scalar> for Bn254Scalar
Source§fn add_assign(&mut self, other: &'a Bn254Scalar)
fn add_assign(&mut self, other: &'a Bn254Scalar)
Performs the
+=
operation. Read moreSource§impl AddAssign for Bn254Scalar
impl AddAssign for Bn254Scalar
Source§fn add_assign(&mut self, other: Self)
fn add_assign(&mut self, other: Self)
Performs the
+=
operation. Read moreSource§impl Clone for Bn254Scalar
impl Clone for Bn254Scalar
Source§fn clone(&self) -> Bn254Scalar
fn clone(&self) -> Bn254Scalar
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for Bn254Scalar
impl Debug for Bn254Scalar
Source§impl<'de> Deserialize<'de> for Bn254Scalar
impl<'de> Deserialize<'de> for Bn254Scalar
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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
impl<'a> DivAssignUnsafe<&'a Bn254Scalar> for Bn254Scalar
Source§fn div_assign_unsafe(&mut self, other: &'a Bn254Scalar)
fn div_assign_unsafe(&mut self, other: &'a Bn254Scalar)
Undefined behaviour when denominator is not coprime to N
Source§impl DivAssignUnsafe for Bn254Scalar
impl DivAssignUnsafe for Bn254Scalar
Source§fn div_assign_unsafe(&mut self, other: Self)
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
impl<'a> DivUnsafe<&'a Bn254Scalar> for Bn254Scalar
Source§fn div_unsafe(self, other: &'a Bn254Scalar) -> Self::Output
fn div_unsafe(self, other: &'a Bn254Scalar) -> Self::Output
Undefined behaviour when denominator is not coprime to N
Source§type Output = Bn254Scalar
type Output = Bn254Scalar
Output type of
div_unsafe
.Source§impl DivUnsafe for Bn254Scalar
impl DivUnsafe for Bn254Scalar
Source§fn div_unsafe(self, other: Self) -> Self::Output
fn div_unsafe(self, other: Self) -> Self::Output
Undefined behaviour when denominator is not coprime to N
Source§type Output = Bn254Scalar
type Output = Bn254Scalar
Output type of
div_unsafe
.Source§impl IntMod for Bn254Scalar
impl IntMod for Bn254Scalar
Source§fn assert_reduced(&self)
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 NUM_LIMBS: usize = 32usize
const NUM_LIMBS: usize = 32usize
Number of limbs used to internally represent an element of
Self
.Source§type Repr = [u8; 32]
type Repr = [u8; 32]
Underlying representation of IntMod. Usually of the form
[u8; NUM_LIMBS]
.Source§type SelfRef<'a> = &'a Bn254Scalar
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
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
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
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
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
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
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] ⓘ
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]
fn to_be_bytes(&self) -> [u8; 32]
Value of this IntMod as an array of bytes, big endian.
Source§fn modulus_biguint() -> BigUint
fn modulus_biguint() -> BigUint
Modulus N as a BigUint.
Source§fn from_biguint(biguint: BigUint) -> Self
fn from_biguint(biguint: BigUint) -> Self
Creates a new IntMod from a BigUint.
Source§fn as_biguint(&self) -> BigUint
fn as_biguint(&self) -> BigUint
Value of this IntMod as a BigUint.
fn neg_assign(&mut self)
Source§fn double_assign(&mut self)
fn double_assign(&mut self)
Doubles
self
in-place.Source§fn square_assign(&mut self)
fn square_assign(&mut self)
Squares
self
in-place.Source§fn is_reduced(&self) -> bool
fn is_reduced(&self) -> bool
Is the integer representation of
self
less than the modulus?Source§impl<'a> Mul<&'a Bn254Scalar> for Bn254Scalar
impl<'a> Mul<&'a Bn254Scalar> for Bn254Scalar
Source§type Output = Bn254Scalar
type Output = Bn254Scalar
The resulting type after applying the
*
operator.Source§impl Mul for Bn254Scalar
impl Mul for Bn254Scalar
Source§impl<'a> MulAssign<&'a Bn254Scalar> for Bn254Scalar
impl<'a> MulAssign<&'a Bn254Scalar> for Bn254Scalar
Source§fn mul_assign(&mut self, other: &'a Bn254Scalar)
fn mul_assign(&mut self, other: &'a Bn254Scalar)
Performs the
*=
operation. Read moreSource§impl MulAssign for Bn254Scalar
impl MulAssign for Bn254Scalar
Source§fn mul_assign(&mut self, other: Self)
fn mul_assign(&mut self, other: Self)
Performs the
*=
operation. Read moreSource§impl Neg for Bn254Scalar
impl Neg for Bn254Scalar
Source§impl PartialEq for Bn254Scalar
impl PartialEq for Bn254Scalar
Source§impl<'a> Product<&'a Bn254Scalar> for Bn254Scalar
impl<'a> Product<&'a Bn254Scalar> for Bn254Scalar
Source§fn product<I: Iterator<Item = &'a Bn254Scalar>>(iter: I) -> Self
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
impl Product for Bn254Scalar
Source§impl Reduce for Bn254Scalar
impl Reduce for Bn254Scalar
Source§fn reduce_le_bytes(bytes: &[u8]) -> Self
fn reduce_le_bytes(bytes: &[u8]) -> Self
Interpret the given bytes as an integer and perform a modular reduction.
fn reduce_be_bytes(bytes: &[u8]) -> Self
Source§impl Serialize for Bn254Scalar
impl Serialize for Bn254Scalar
Source§impl<'a> Sub<&'a Bn254Scalar> for Bn254Scalar
impl<'a> Sub<&'a Bn254Scalar> for Bn254Scalar
Source§type Output = Bn254Scalar
type Output = Bn254Scalar
The resulting type after applying the
-
operator.Source§impl Sub for Bn254Scalar
impl Sub for Bn254Scalar
Source§impl<'a> SubAssign<&'a Bn254Scalar> for Bn254Scalar
impl<'a> SubAssign<&'a Bn254Scalar> for Bn254Scalar
Source§fn sub_assign(&mut self, other: &'a Bn254Scalar)
fn sub_assign(&mut self, other: &'a Bn254Scalar)
Performs the
-=
operation. Read moreSource§impl SubAssign for Bn254Scalar
impl SubAssign for Bn254Scalar
Source§fn sub_assign(&mut self, other: Self)
fn sub_assign(&mut self, other: Self)
Performs the
-=
operation. Read moreSource§impl<'a> Sum<&'a Bn254Scalar> for Bn254Scalar
impl<'a> Sum<&'a Bn254Scalar> for Bn254Scalar
Source§fn sum<I: Iterator<Item = &'a Bn254Scalar>>(iter: I) -> Self
fn sum<I: Iterator<Item = &'a Bn254Scalar>>(iter: I) -> Self
Takes an iterator and generates
Self
from the elements by “summing up”
the items.