pub type Scalar = Bls12_381Scalar;
Aliased Type§
struct Scalar(/* private fields */);
Implementations
Source§impl Bls12_381Scalar
impl Bls12_381Scalar
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 Bls12_381Scalar
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 Bls12_381Scalar> for Bls12_381Scalar
impl<'a> Add<&'a Bls12_381Scalar> for Bls12_381Scalar
Source§type Output = Bls12_381Scalar
type Output = Bls12_381Scalar
The resulting type after applying the
+
operator.Source§impl Add for Bls12_381Scalar
impl Add for Bls12_381Scalar
Source§impl<'a> AddAssign<&'a Bls12_381Scalar> for Bls12_381Scalar
impl<'a> AddAssign<&'a Bls12_381Scalar> for Bls12_381Scalar
Source§fn add_assign(&mut self, other: &'a Bls12_381Scalar)
fn add_assign(&mut self, other: &'a Bls12_381Scalar)
Performs the
+=
operation. Read moreSource§impl AddAssign for Bls12_381Scalar
impl AddAssign for Bls12_381Scalar
Source§fn add_assign(&mut self, other: Self)
fn add_assign(&mut self, other: Self)
Performs the
+=
operation. Read moreSource§impl Clone for Bls12_381Scalar
impl Clone for Bls12_381Scalar
Source§fn clone(&self) -> Bls12_381Scalar
fn clone(&self) -> Bls12_381Scalar
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 Bls12_381Scalar
impl Debug for Bls12_381Scalar
Source§impl<'de> Deserialize<'de> for Bls12_381Scalar
impl<'de> Deserialize<'de> for Bls12_381Scalar
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 Bls12_381Scalar> for Bls12_381Scalar
impl<'a> DivAssignUnsafe<&'a Bls12_381Scalar> for Bls12_381Scalar
Source§fn div_assign_unsafe(&mut self, other: &'a Bls12_381Scalar)
fn div_assign_unsafe(&mut self, other: &'a Bls12_381Scalar)
Undefined behaviour when denominator is not coprime to N
Source§impl DivAssignUnsafe for Bls12_381Scalar
impl DivAssignUnsafe for Bls12_381Scalar
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 Bls12_381Scalar> for Bls12_381Scalar
impl<'a> DivUnsafe<&'a Bls12_381Scalar> for Bls12_381Scalar
Source§fn div_unsafe(self, other: &'a Bls12_381Scalar) -> Self::Output
fn div_unsafe(self, other: &'a Bls12_381Scalar) -> Self::Output
Undefined behaviour when denominator is not coprime to N
Source§type Output = Bls12_381Scalar
type Output = Bls12_381Scalar
Output type of
div_unsafe
.Source§impl DivUnsafe for Bls12_381Scalar
impl DivUnsafe for Bls12_381Scalar
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 = Bls12_381Scalar
type Output = Bls12_381Scalar
Output type of
div_unsafe
.Source§impl IntMod for Bls12_381Scalar
impl IntMod for Bls12_381Scalar
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 Bls12_381Scalar
type SelfRef<'a> = &'a Bls12_381Scalar
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 Bls12_381Scalar> for Bls12_381Scalar
impl<'a> Mul<&'a Bls12_381Scalar> for Bls12_381Scalar
Source§type Output = Bls12_381Scalar
type Output = Bls12_381Scalar
The resulting type after applying the
*
operator.Source§impl Mul for Bls12_381Scalar
impl Mul for Bls12_381Scalar
Source§impl<'a> MulAssign<&'a Bls12_381Scalar> for Bls12_381Scalar
impl<'a> MulAssign<&'a Bls12_381Scalar> for Bls12_381Scalar
Source§fn mul_assign(&mut self, other: &'a Bls12_381Scalar)
fn mul_assign(&mut self, other: &'a Bls12_381Scalar)
Performs the
*=
operation. Read moreSource§impl MulAssign for Bls12_381Scalar
impl MulAssign for Bls12_381Scalar
Source§fn mul_assign(&mut self, other: Self)
fn mul_assign(&mut self, other: Self)
Performs the
*=
operation. Read moreSource§impl Neg for Bls12_381Scalar
impl Neg for Bls12_381Scalar
Source§impl PartialEq for Bls12_381Scalar
impl PartialEq for Bls12_381Scalar
Source§impl<'a> Product<&'a Bls12_381Scalar> for Bls12_381Scalar
impl<'a> Product<&'a Bls12_381Scalar> for Bls12_381Scalar
Source§fn product<I: Iterator<Item = &'a Bls12_381Scalar>>(iter: I) -> Self
fn product<I: Iterator<Item = &'a Bls12_381Scalar>>(iter: I) -> Self
Takes an iterator and generates
Self
from the elements by multiplying
the items.Source§impl Product for Bls12_381Scalar
impl Product for Bls12_381Scalar
Source§impl Reduce for Bls12_381Scalar
impl Reduce for Bls12_381Scalar
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 Bls12_381Scalar
impl Serialize for Bls12_381Scalar
Source§impl<'a> Sub<&'a Bls12_381Scalar> for Bls12_381Scalar
impl<'a> Sub<&'a Bls12_381Scalar> for Bls12_381Scalar
Source§type Output = Bls12_381Scalar
type Output = Bls12_381Scalar
The resulting type after applying the
-
operator.Source§impl Sub for Bls12_381Scalar
impl Sub for Bls12_381Scalar
Source§impl<'a> SubAssign<&'a Bls12_381Scalar> for Bls12_381Scalar
impl<'a> SubAssign<&'a Bls12_381Scalar> for Bls12_381Scalar
Source§fn sub_assign(&mut self, other: &'a Bls12_381Scalar)
fn sub_assign(&mut self, other: &'a Bls12_381Scalar)
Performs the
-=
operation. Read moreSource§impl SubAssign for Bls12_381Scalar
impl SubAssign for Bls12_381Scalar
Source§fn sub_assign(&mut self, other: Self)
fn sub_assign(&mut self, other: Self)
Performs the
-=
operation. Read moreSource§impl<'a> Sum<&'a Bls12_381Scalar> for Bls12_381Scalar
impl<'a> Sum<&'a Bls12_381Scalar> for Bls12_381Scalar
Source§fn sum<I: Iterator<Item = &'a Bls12_381Scalar>>(iter: I) -> Self
fn sum<I: Iterator<Item = &'a Bls12_381Scalar>>(iter: I) -> Self
Takes an iterator and generates
Self
from the elements by “summing up”
the items.