[][src]Struct bls12_381::Scalar

pub struct Scalar(_);

Represents an element of the scalar field $\mathbb{F}_q$ of the BLS12-381 elliptic curve construction.

Implementations

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 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 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.

Trait Implementations

impl<'a, 'b> Add<&'b Scalar> for &'a Scalar[src]

type Output = Scalar

The resulting type after applying the + operator.

impl<'b> Add<&'b Scalar> for Scalar[src]

type Output = Scalar

The resulting type after applying the + operator.

impl<'a> Add<Scalar> for &'a Scalar[src]

type Output = Scalar

The resulting type after applying the + operator.

impl Add<Scalar> for Scalar[src]

type Output = Scalar

The resulting type after applying the + operator.

impl<'b> AddAssign<&'b Scalar> for Scalar[src]

impl AddAssign<Scalar> for Scalar[src]

impl Clone for Scalar[src]

impl ConditionallySelectable for Scalar[src]

impl ConstantTimeEq for Scalar[src]

impl Copy for Scalar[src]

impl Debug for Scalar[src]

impl Default for Scalar[src]

impl Display for Scalar[src]

impl Eq for Scalar[src]

impl Field for Scalar[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.

impl<'b> Mul<&'b Scalar> for Scalar[src]

type Output = Scalar

The resulting type after applying the * operator.

impl<'a, 'b> Mul<&'b Scalar> for &'a Gt[src]

type Output = Gt

The resulting type after applying the * operator.

impl<'b> Mul<&'b Scalar> for Gt[src]

type Output = Gt

The resulting type after applying the * operator.

impl<'a, 'b> Mul<&'b Scalar> for &'a G1Projective[src]

type Output = G1Projective

The resulting type after applying the * operator.

impl<'a, 'b> Mul<&'b Scalar> for &'a G1Affine[src]

type Output = G1Projective

The resulting type after applying the * operator.

impl<'b> Mul<&'b Scalar> for G1Projective[src]

type Output = G1Projective

The resulting type after applying the * operator.

impl<'b> Mul<&'b Scalar> for G1Affine[src]

type Output = G1Projective

The resulting type after applying the * operator.

impl<'a, 'b> Mul<&'b Scalar> for &'a G2Projective[src]

type Output = G2Projective

The resulting type after applying the * operator.

impl<'a, 'b> Mul<&'b Scalar> for &'a G2Affine[src]

type Output = G2Projective

The resulting type after applying the * operator.

impl<'b> Mul<&'b Scalar> for G2Projective[src]

type Output = G2Projective

The resulting type after applying the * operator.

impl<'b> Mul<&'b Scalar> for G2Affine[src]

type Output = G2Projective

The resulting type after applying the * operator.

impl<'a> Mul<Scalar> for &'a Scalar[src]

type Output = Scalar

The resulting type after applying the * operator.

impl Mul<Scalar> for Scalar[src]

type Output = Scalar

The resulting type after applying the * operator.

impl<'a> Mul<Scalar> for &'a Gt[src]

type Output = Gt

The resulting type after applying the * operator.

impl Mul<Scalar> for Gt[src]

type Output = Gt

The resulting type after applying the * operator.

impl<'a> Mul<Scalar> for &'a G1Projective[src]

type Output = G1Projective

The resulting type after applying the * operator.

impl Mul<Scalar> for G1Projective[src]

type Output = G1Projective

The resulting type after applying the * operator.

impl<'a> Mul<Scalar> for &'a G1Affine[src]

type Output = G1Projective

The resulting type after applying the * operator.

impl Mul<Scalar> for G1Affine[src]

type Output = G1Projective

The resulting type after applying the * operator.

impl<'a> Mul<Scalar> for &'a G2Projective[src]

type Output = G2Projective

The resulting type after applying the * operator.

impl Mul<Scalar> for G2Projective[src]

type Output = G2Projective

The resulting type after applying the * operator.

impl<'a> Mul<Scalar> for &'a G2Affine[src]

type Output = G2Projective

The resulting type after applying the * operator.

impl Mul<Scalar> for G2Affine[src]

type Output = G2Projective

The resulting type after applying the * operator.

impl<'b> MulAssign<&'b Scalar> for Scalar[src]

impl<'b> MulAssign<&'b Scalar> for G1Projective[src]

impl<'b> MulAssign<&'b Scalar> for G2Projective[src]

impl<'b> MulAssign<&'b Scalar> for Gt[src]

impl MulAssign<Scalar> for Scalar[src]

impl MulAssign<Scalar> for G1Projective[src]

impl MulAssign<Scalar> for G2Projective[src]

impl MulAssign<Scalar> for Gt[src]

impl<'a> Neg for &'a Scalar[src]

type Output = Scalar

The resulting type after applying the - operator.

impl Neg for Scalar[src]

type Output = Scalar

The resulting type after applying the - operator.

impl PartialEq<Scalar> for Scalar[src]

impl PrimeField for Scalar[src]

type Repr = [u8; 32]

The prime field can be converted back and forth into this binary representation. Read more

type ReprBits = [u64; 4]

The backing store for a bit representation of a prime field element.

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.

impl<'b> Sub<&'b Scalar> for Scalar[src]

type Output = Scalar

The resulting type after applying the - operator.

impl<'a> Sub<Scalar> for &'a Scalar[src]

type Output = Scalar

The resulting type after applying the - operator.

impl Sub<Scalar> for Scalar[src]

type Output = Scalar

The resulting type after applying the - operator.

impl<'b> SubAssign<&'b Scalar> for Scalar[src]

impl SubAssign<Scalar> for Scalar[src]

impl<T> Sum<T> for Scalar where
    T: Borrow<Scalar>, 
[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> ConditionallyNegatable for T where
    T: ConditionallySelectable,
    &'a T: for<'a> Neg,
    <&'a T as Neg>::Output == T, 
[src]

impl<T> Conv for T

impl<T> Conv for T

impl<T> FmtForward for T

impl<T> From<T> for T[src]

impl<T, Rhs, Output> GroupOps<Rhs, Output> for T where
    T: Add<Rhs, Output = Output> + Sub<Rhs, Output = Output> + AddAssign<Rhs> + SubAssign<Rhs>, 
[src]

impl<T, Rhs, Output> GroupOpsOwned<Rhs, Output> for T where
    T: for<'r> GroupOps<&'r Rhs, Output>, 
[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pipe for T where
    T: ?Sized

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T, Rhs, Output> ScalarMul<Rhs, Output> for T where
    T: Mul<Rhs, Output = Output> + MulAssign<Rhs>, 
[src]

impl<T, Rhs, Output> ScalarMulOwned<Rhs, Output> for T where
    T: for<'r> ScalarMul<&'r Rhs, Output>, 
[src]

impl<T> Tap for T

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> TryConv for T

impl<T> TryConv for T

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.