[−][src]Struct dusk_bls12_381::Scalar
Represents an element of the scalar field $\mathbb{F}_q$ of the BLS12-381 elliptic curve construction.
Methods
impl Scalar
[src]
pub const fn zero() -> Scalar
[src]
Returns zero, the additive identity.
pub const fn one() -> Scalar
[src]
Returns one, the multiplicative identity.
pub const fn internal_repr(&self) -> &[u64; 4]
[src]
Returns the internal representation of the Scalar.
pub const fn double(&self) -> Scalar
[src]
Doubles this field element.
pub fn from_bytes(bytes: &[u8; 32]) -> CtOption<Scalar>
[src]
Attempts to convert a little-endian byte representation of
a scalar into a Scalar
, failing if the input is not canonical.
pub fn to_bytes(&self) -> [u8; 32]
[src]
Converts an element of Scalar
into a byte representation in
little-endian byte order.
pub fn from_bytes_wide(bytes: &[u8; 64]) -> Scalar
[src]
Converts a 512-bit little endian integer into
a Scalar
by reducing by the modulus.
pub const fn from_raw(val: [u64; 4]) -> Self
[src]
Converts from an integer represented in little endian
into its (congruent) Scalar
representation.
pub fn random<T>(rand: &mut T) -> Scalar where
T: Rng + CryptoRng,
[src]
T: Rng + CryptoRng,
Generate a valid Scalar choosen uniformly using user- provided rng.
By rng
we mean any Rng that implements: Rng
+ CryptoRng
.
pub fn reduce(&self) -> Scalar
[src]
Reduces the scalar and returns it multiplied by the montgomery radix.
pub const fn square(&self) -> Scalar
[src]
Squares this element.
pub fn sqrt(&self) -> CtOption<Self>
[src]
Computes the square root of this element, if it exists.
pub fn pow(&self, by: &[u64; 4]) -> Self
[src]
Exponentiates self
by by
, where by
is a
little-endian order integer exponent.
pub fn pow_vartime(&self, by: &[u64; 4]) -> Self
[src]
Exponentiates self
by by
, where by
is a
little-endian order integer exponent.
This operation is variable time with respect to the exponent. If the exponent is fixed, this operation is effectively constant time.
pub fn invert(&self) -> CtOption<Self>
[src]
Computes the multiplicative inverse of this element, failing if the element is zero.
pub const fn mul(&self, rhs: &Self) -> Self
[src]
Multiplies rhs
by self
, returning the result.
pub const fn sub(&self, rhs: &Self) -> Self
[src]
Subtracts rhs
from self
, returning the result.
pub const fn add(&self, rhs: &Self) -> Self
[src]
Adds rhs
to self
, returning the result.
pub const fn neg(&self) -> Self
[src]
Negates self
.
pub fn divn(&mut self, n: u32)
[src]
SHR impl
Trait Implementations
impl<'a, 'b> Add<&'b Scalar> for &'a Scalar
[src]
type Output = Scalar
The resulting type after applying the +
operator.
fn add(self, rhs: &'b Scalar) -> Scalar
[src]
impl<'b> Add<&'b Scalar> for Scalar
[src]
type Output = Scalar
The resulting type after applying the +
operator.
fn add(self, rhs: &'b Scalar) -> Scalar
[src]
impl<'a> Add<Scalar> for &'a Scalar
[src]
type Output = Scalar
The resulting type after applying the +
operator.
fn add(self, rhs: Scalar) -> Scalar
[src]
impl Add<Scalar> for Scalar
[src]
type Output = Scalar
The resulting type after applying the +
operator.
fn add(self, rhs: Scalar) -> Scalar
[src]
impl<'b> AddAssign<&'b Scalar> for Scalar
[src]
fn add_assign(&mut self, rhs: &'b Scalar)
[src]
impl AddAssign<Scalar> for Scalar
[src]
fn add_assign(&mut self, rhs: Scalar)
[src]
impl<'a, 'b> BitAnd<&'b Scalar> for &'a Scalar
[src]
type Output = Scalar
The resulting type after applying the &
operator.
fn bitand(self, rhs: &'b Scalar) -> Scalar
[src]
impl BitAnd<Scalar> for Scalar
[src]
type Output = Scalar
The resulting type after applying the &
operator.
fn bitand(self, rhs: Scalar) -> Scalar
[src]
impl<'a, 'b> BitXor<&'b Scalar> for &'a Scalar
[src]
type Output = Scalar
The resulting type after applying the ^
operator.
fn bitxor(self, rhs: &'b Scalar) -> Scalar
[src]
impl BitXor<Scalar> for Scalar
[src]
type Output = Scalar
The resulting type after applying the ^
operator.
fn bitxor(self, rhs: Scalar) -> Scalar
[src]
impl Clone for Scalar
[src]
impl ConditionallySelectable for Scalar
[src]
fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self
[src]
fn conditional_assign(&mut self, other: &Self, choice: Choice)
[src]
fn conditional_swap(a: &mut Self, b: &mut Self, choice: Choice)
[src]
impl ConstantTimeEq for Scalar
[src]
impl Copy for Scalar
[src]
impl Debug for Scalar
[src]
impl Default for Scalar
[src]
impl<'de> Deserialize<'de> for Scalar
[src]
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
[src]
D: Deserializer<'de>,
impl Eq for Scalar
[src]
impl<'a> From<&'a Scalar> for [u8; 32]
[src]
impl From<u64> for Scalar
[src]
impl<'a, 'b> Mul<&'b Scalar> for &'a Scalar
[src]
type Output = Scalar
The resulting type after applying the *
operator.
fn mul(self, rhs: &'b Scalar) -> Scalar
[src]
impl<'b> Mul<&'b Scalar> for Scalar
[src]
type Output = Scalar
The resulting type after applying the *
operator.
fn mul(self, rhs: &'b Scalar) -> Scalar
[src]
impl<'a, 'b> Mul<&'b Scalar> for &'a Gt
[src]
type Output = Gt
The resulting type after applying the *
operator.
fn mul(self, other: &'b Scalar) -> Self::Output
[src]
impl<'b> Mul<&'b Scalar> for Gt
[src]
type Output = Gt
The resulting type after applying the *
operator.
fn mul(self, rhs: &'b Scalar) -> Gt
[src]
impl<'a, 'b> Mul<&'b Scalar> for &'a G1Projective
[src]
type Output = G1Projective
The resulting type after applying the *
operator.
fn mul(self, other: &'b Scalar) -> Self::Output
[src]
impl<'a, 'b> Mul<&'b Scalar> for &'a G1Affine
[src]
type Output = G1Projective
The resulting type after applying the *
operator.
fn mul(self, other: &'b Scalar) -> Self::Output
[src]
impl<'b> Mul<&'b Scalar> for G1Projective
[src]
type Output = G1Projective
The resulting type after applying the *
operator.
fn mul(self, rhs: &'b Scalar) -> G1Projective
[src]
impl<'b> Mul<&'b Scalar> for G1Affine
[src]
type Output = G1Projective
The resulting type after applying the *
operator.
fn mul(self, rhs: &'b Scalar) -> G1Projective
[src]
impl<'a, 'b> Mul<&'b Scalar> for &'a G2Projective
[src]
type Output = G2Projective
The resulting type after applying the *
operator.
fn mul(self, other: &'b Scalar) -> Self::Output
[src]
impl<'a, 'b> Mul<&'b Scalar> for &'a G2Affine
[src]
type Output = G2Projective
The resulting type after applying the *
operator.
fn mul(self, other: &'b Scalar) -> Self::Output
[src]
impl<'b> Mul<&'b Scalar> for G2Projective
[src]
type Output = G2Projective
The resulting type after applying the *
operator.
fn mul(self, rhs: &'b Scalar) -> G2Projective
[src]
impl<'b> Mul<&'b Scalar> for G2Affine
[src]
type Output = G2Projective
The resulting type after applying the *
operator.
fn mul(self, rhs: &'b Scalar) -> G2Projective
[src]
impl<'a> Mul<Scalar> for &'a Scalar
[src]
type Output = Scalar
The resulting type after applying the *
operator.
fn mul(self, rhs: Scalar) -> Scalar
[src]
impl Mul<Scalar> for Scalar
[src]
type Output = Scalar
The resulting type after applying the *
operator.
fn mul(self, rhs: Scalar) -> Scalar
[src]
impl<'a> Mul<Scalar> for &'a Gt
[src]
type Output = Gt
The resulting type after applying the *
operator.
fn mul(self, rhs: Scalar) -> Gt
[src]
impl Mul<Scalar> for Gt
[src]
type Output = Gt
The resulting type after applying the *
operator.
fn mul(self, rhs: Scalar) -> Gt
[src]
impl<'a> Mul<Scalar> for &'a G1Projective
[src]
type Output = G1Projective
The resulting type after applying the *
operator.
fn mul(self, rhs: Scalar) -> G1Projective
[src]
impl Mul<Scalar> for G1Projective
[src]
type Output = G1Projective
The resulting type after applying the *
operator.
fn mul(self, rhs: Scalar) -> G1Projective
[src]
impl<'a> Mul<Scalar> for &'a G1Affine
[src]
type Output = G1Projective
The resulting type after applying the *
operator.
fn mul(self, rhs: Scalar) -> G1Projective
[src]
impl Mul<Scalar> for G1Affine
[src]
type Output = G1Projective
The resulting type after applying the *
operator.
fn mul(self, rhs: Scalar) -> G1Projective
[src]
impl<'a> Mul<Scalar> for &'a G2Projective
[src]
type Output = G2Projective
The resulting type after applying the *
operator.
fn mul(self, rhs: Scalar) -> G2Projective
[src]
impl Mul<Scalar> for G2Projective
[src]
type Output = G2Projective
The resulting type after applying the *
operator.
fn mul(self, rhs: Scalar) -> G2Projective
[src]
impl<'a> Mul<Scalar> for &'a G2Affine
[src]
type Output = G2Projective
The resulting type after applying the *
operator.
fn mul(self, rhs: Scalar) -> G2Projective
[src]
impl Mul<Scalar> for G2Affine
[src]
type Output = G2Projective
The resulting type after applying the *
operator.
fn mul(self, rhs: Scalar) -> G2Projective
[src]
impl<'b> MulAssign<&'b Scalar> for Scalar
[src]
fn mul_assign(&mut self, rhs: &'b Scalar)
[src]
impl<'b> MulAssign<&'b Scalar> for G1Projective
[src]
fn mul_assign(&mut self, rhs: &'b Scalar)
[src]
impl<'b> MulAssign<&'b Scalar> for G2Projective
[src]
fn mul_assign(&mut self, rhs: &'b Scalar)
[src]
impl<'b> MulAssign<&'b Scalar> for Gt
[src]
fn mul_assign(&mut self, rhs: &'b Scalar)
[src]
impl MulAssign<Scalar> for Scalar
[src]
fn mul_assign(&mut self, rhs: Scalar)
[src]
impl MulAssign<Scalar> for G1Projective
[src]
fn mul_assign(&mut self, rhs: Scalar)
[src]
impl MulAssign<Scalar> for G2Projective
[src]
fn mul_assign(&mut self, rhs: Scalar)
[src]
impl MulAssign<Scalar> for Gt
[src]
fn mul_assign(&mut self, rhs: Scalar)
[src]
impl<'a> Neg for &'a Scalar
[src]
impl Neg for Scalar
[src]
impl Ord for Scalar
[src]
fn cmp(&self, other: &Self) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<Scalar> for Scalar
[src]
impl PartialOrd<Scalar> for Scalar
[src]
fn partial_cmp(&self, other: &Scalar) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<T> Product<T> for Scalar where
T: Borrow<Scalar>,
[src]
T: Borrow<Scalar>,
impl Serialize for Scalar
[src]
impl StructuralEq for Scalar
[src]
impl<'a, 'b> Sub<&'b Scalar> for &'a Scalar
[src]
type Output = Scalar
The resulting type after applying the -
operator.
fn sub(self, rhs: &'b Scalar) -> Scalar
[src]
impl<'b> Sub<&'b Scalar> for Scalar
[src]
type Output = Scalar
The resulting type after applying the -
operator.
fn sub(self, rhs: &'b Scalar) -> Scalar
[src]
impl<'a> Sub<Scalar> for &'a Scalar
[src]
type Output = Scalar
The resulting type after applying the -
operator.
fn sub(self, rhs: Scalar) -> Scalar
[src]
impl Sub<Scalar> for Scalar
[src]
type Output = Scalar
The resulting type after applying the -
operator.
fn sub(self, rhs: Scalar) -> Scalar
[src]
impl<'b> SubAssign<&'b Scalar> for Scalar
[src]
fn sub_assign(&mut self, rhs: &'b Scalar)
[src]
impl SubAssign<Scalar> for Scalar
[src]
fn sub_assign(&mut self, rhs: Scalar)
[src]
impl<T> Sum<T> for Scalar where
T: Borrow<Scalar>,
[src]
T: Borrow<Scalar>,
Auto Trait Implementations
impl RefUnwindSafe for Scalar
impl Send for Scalar
impl Sync for Scalar
impl Unpin for Scalar
impl UnwindSafe for Scalar
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> ConditionallyNegatable for T where
T: ConditionallySelectable,
&'a T: for<'a> Neg,
<&'a T as Neg>::Output == T,
[src]
T: ConditionallySelectable,
&'a T: for<'a> Neg,
<&'a T as Neg>::Output == T,
fn conditional_negate(&mut self, choice: Choice)
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,