[−]Struct dusk_plonk::prelude::BlsScalar
Re-exported dusk-bls12_381::Scalar
.
Represents an element of the scalar field 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,
[−]
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][+]
type Output = Polynomial
fn add(self, constant: &'a Scalar) -> Polynomial
[src][−]
impl<'b> Add<&'b Scalar> for Scalar
[+]
impl<'a, 'b> Add<&'b Scalar> for &'a Scalar
[+]
impl<'a> Add<Scalar> for &'a Scalar
[+]
impl Add<Scalar> for Scalar
[+]
impl<'b> AddAssign<&'b Scalar> for Scalar
[+]
impl AddAssign<Scalar> for Scalar
[+]
impl<'a, 'b> BitAnd<&'b Scalar> for &'a Scalar
[+]
impl BitAnd<Scalar> for Scalar
[+]
impl<'a, 'b> BitXor<&'b Scalar> for &'a Scalar
[+]
impl BitXor<Scalar> for Scalar
[+]
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][+]
type Output = Polynomial
fn mul(self, constant: &'a Scalar) -> Polynomial
[src][−]
impl<'a, 'b> Mul<&'b Scalar> for &'a Scalar
[+]
impl<'b> Mul<&'b Scalar> for Scalar
[+]
impl Mul<Scalar> for Scalar
[+]
impl<'a> Mul<Scalar> for &'a Scalar
[+]
impl<'b> MulAssign<&'b Scalar> for Scalar
[+]
impl MulAssign<Scalar> for Scalar
[+]
impl<'a> Neg for &'a Scalar
[+]
impl Neg for Scalar
[+]
impl Ord for Scalar
[+]
impl PartialEq<Scalar> for Scalar
[+]
impl PartialOrd<Scalar> for Scalar
[+]
impl<T> Product<T> for Scalar where
T: Borrow<Scalar>,
[+]
T: Borrow<Scalar>,
impl Serialize for Scalar
[+]
impl<'a, 'b> Sub<&'a Scalar> for &'b Polynomial
[src][+]
impl<'a, 'b> Sub<&'b Scalar> for &'a Scalar
[+]
impl<'b> Sub<&'b Scalar> for Scalar
[+]
impl Sub<Scalar> for Scalar
[+]
impl<'a> Sub<Scalar> for &'a Scalar
[+]
impl<'b> SubAssign<&'b Scalar> for Scalar
[+]
impl SubAssign<Scalar> for Scalar
[+]
impl<T> Sum<T> for Scalar where
T: Borrow<Scalar>,
[+]
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,
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,
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,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src][+]
U: Into<T>,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src][+]
U: TryFrom<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[+]
V: MultiLane<T>,