[]Struct dusk_plonk::prelude::BlsScalar

pub struct BlsScalar(pub [u64; 4]);

Re-exported dusk-bls12_381::Scalar. Represents an element of the scalar field $\mathbb{F}_q$ of the BLS12-381 elliptic curve construction.

Implementations

impl Scalar

Re-exported dusk-bls12_381::Scalar.

pub const fn zero() -> Scalar

Returns zero, the additive identity.

pub const fn one() -> Scalar

Returns one, the multiplicative identity.

pub const fn internal_repr(&self) -> &[u64; 4]

Returns the internal representation of the Scalar.

pub const fn double(&self) -> Scalar

Doubles this field element.

pub fn from_bytes(bytes: &[u8; 32]) -> CtOption<Scalar>

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]

Converts an element of Scalar into a byte representation in little-endian byte order.

pub fn to_bits(&self) -> [u8; 256]

Returns the bit representation of the given Scalar as an array of 256 bits represented as u8.

pub fn from_bytes_wide(bytes: &[u8; 64]) -> Scalar

Converts a 512-bit little endian integer into a Scalar by reducing by the modulus.

pub const fn from_raw(val: [u64; 4]) -> Scalar

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

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

Reduces the scalar and returns it multiplied by the montgomery radix.

pub const fn square(&self) -> Scalar

Squares this element.

pub fn sqrt(&self) -> CtOption<Scalar>

Computes the square root of this element, if it exists.

pub fn pow(&self, by: &[u64; 4]) -> Scalar

Exponentiates self by by, where by is a little-endian order integer exponent.

pub fn pow_vartime(&self, by: &[u64; 4]) -> Scalar

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

Computes the multiplicative inverse of this element, failing if the element is zero.

pub const fn mul(&self, rhs: &Scalar) -> Scalar

Multiplies rhs by self, returning the result.

pub const fn sub(&self, rhs: &Scalar) -> Scalar

Subtracts rhs from self, returning the result.

pub const fn add(&self, rhs: &Scalar) -> Scalar

Adds rhs to self, returning the result.

pub const fn neg(&self) -> Scalar

Negates self.

pub fn divn(&mut self, n: u32)

SHR impl

Trait Implementations

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

Convenience Trait to sub a scalar and polynomial

type Output = Polynomial

The resulting type after applying the + operator.

impl<'b> Add<&'b Scalar> for Scalar

type Output = Scalar

The resulting type after applying the + operator.

impl<'a, 'b> Add<&'b Scalar> for &'a Scalar

type Output = Scalar

The resulting type after applying the + operator.

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

type Output = Scalar

The resulting type after applying the + operator.

impl Add<Scalar> for Scalar

type Output = Scalar

The resulting type after applying the + operator.

impl<'b> AddAssign<&'b Scalar> for Scalar

impl AddAssign<Scalar> for Scalar

impl<'a, 'b> BitAnd<&'b Scalar> for &'a Scalar

type Output = Scalar

The resulting type after applying the & operator.

impl BitAnd<Scalar> for Scalar

type Output = Scalar

The resulting type after applying the & operator.

impl<'a, 'b> BitXor<&'b Scalar> for &'a Scalar

type Output = Scalar

The resulting type after applying the ^ operator.

impl BitXor<Scalar> for Scalar

type Output = Scalar

The resulting type after applying the ^ operator.

impl Clone for Scalar

impl ConditionallySelectable for Scalar

impl ConstantTimeEq for Scalar

impl Copy for Scalar

impl Debug for Scalar

impl Default for Scalar

impl<'de> Deserialize<'de> for Scalar

impl Eq for Scalar

impl From<Fr> for Scalar

impl From<u64> for Scalar

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

Convenience Trait to multiply a scalar and polynomial

type Output = Polynomial

The resulting type after applying the * operator.

impl<'a, 'b> Mul<&'b Scalar> for &'a Scalar

type Output = Scalar

The resulting type after applying the * operator.

impl<'b> Mul<&'b Scalar> for Scalar

type Output = Scalar

The resulting type after applying the * operator.

impl Mul<Scalar> for Scalar

type Output = Scalar

The resulting type after applying the * operator.

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

type Output = Scalar

The resulting type after applying the * operator.

impl<'b> MulAssign<&'b Scalar> for Scalar

impl MulAssign<Scalar> for Scalar

impl<'a> Neg for &'a Scalar

type Output = Scalar

The resulting type after applying the - operator.

impl Neg for Scalar

type Output = Scalar

The resulting type after applying the - operator.

impl Ord for Scalar

impl PartialEq<Scalar> for Scalar

impl PartialOrd<Scalar> for Scalar

impl<T> Product<T> for Scalar where
    T: Borrow<Scalar>, 

impl Serialize for Scalar

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

type Output = Polynomial

The resulting type after applying the - operator.

impl<'a, 'b> Sub<&'b Scalar> for &'a Scalar

type Output = Scalar

The resulting type after applying the - operator.

impl<'b> Sub<&'b Scalar> for Scalar

type Output = Scalar

The resulting type after applying the - operator.

impl Sub<Scalar> for Scalar

type Output = Scalar

The resulting type after applying the - operator.

impl<'a> Sub<Scalar> for &'a Scalar

type Output = Scalar

The resulting type after applying the - operator.

impl<'b> SubAssign<&'b Scalar> for Scalar

impl SubAssign<Scalar> for Scalar

impl<T> Sum<T> for Scalar where
    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]

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> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

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

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

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

type Owned = T

The resulting type after obtaining ownership.

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,