Struct Scalar

Source
pub struct Scalar<E: Curve>(/* private fields */);
Expand description

Scalar modulo curve E group order

Scalar is an integer modulo curve E group order.

Implementations§

Source§

impl<E: Curve> Scalar<E>

Source

pub fn zero() -> Self

Returns scalar $S = 0$

use generic_ec::{Scalar, curves::Secp256k1};
use rand::rngs::OsRng;

let s = Scalar::<Secp256k1>::random(&mut OsRng);
assert_eq!(s * Scalar::zero(), Scalar::zero());
assert_eq!(s + Scalar::zero(), s);
Source

pub fn is_zero(&self) -> bool

Checks whether the scalar is zero

Source

pub fn one() -> Self

Returns scalar $S = 1$

use generic_ec::{Scalar, curves::Secp256k1};
use rand::rngs::OsRng;

let s = Scalar::<Secp256k1>::random(&mut OsRng);
assert_eq!(s * Scalar::one(), s);
Source

pub fn invert(&self) -> Option<Self>

Returns scalar inverse $S^{-1}$

Inverse of scalar $S$ is a scalar $S^{-1}$ such as $S \cdot S^{-1} = 1$. Inverse doesn’t exist only for scalar $S = 0$, so function returns None if scalar is zero.

use generic_ec::{Scalar, curves::Secp256k1};
use rand::rngs::OsRng;

let s = Scalar::<Secp256k1>::random(&mut OsRng);
let s_inv = s.invert()?;
assert_eq!(s * s_inv, Scalar::one());
Source

pub fn ct_invert(&self) -> CtOption<Self>

Returns scalar inverse $S^{-1}$ (constant time)

Same as Scalar::invert but performs constant-time check on whether it’s zero scalar

Source

pub fn to_be_bytes(&self) -> EncodedScalar<E>

Encodes scalar as bytes in big-endian order

use generic_ec::{Scalar, curves::Secp256k1};
use rand::rngs::OsRng;

let s = Scalar::<Secp256k1>::random(&mut OsRng);
let bytes = s.to_be_bytes();
println!("Scalar hex representation: {}", hex::encode(bytes));
Source

pub fn to_le_bytes(&self) -> EncodedScalar<E>

Encodes scalar as bytes in little-endian order

Source

pub fn from_be_bytes(bytes: impl AsRef<[u8]>) -> Result<Self, InvalidScalar>

Decodes scalar from its representation as bytes in big-endian order

Returns error if encoded integer is larger than group order.

use generic_ec::{Scalar, curves::Secp256k1};
use rand::rngs::OsRng;

let s = Scalar::<Secp256k1>::random(&mut OsRng);
let s_bytes = s.to_be_bytes();
let s_decoded = Scalar::from_be_bytes(&s_bytes)?;
assert_eq!(s, s_decoded);
Source

pub fn from_le_bytes(bytes: impl AsRef<[u8]>) -> Result<Self, InvalidScalar>

Decodes scalar from its representation as bytes in little-endian order

Returns error if encoded integer is larger than group order.

Source

pub fn from_be_bytes_mod_order(bytes: impl AsRef<[u8]>) -> Self

Interprets provided bytes as integer $i$ in big-endian order, returns scalar $s = i \mod q$

Source

pub fn from_le_bytes_mod_order(bytes: impl AsRef<[u8]>) -> Self

Interprets provided bytes as integer $i$ in little-endian order, returns scalar $s = i \mod q$

Source

pub fn random<R: RngCore>(rng: &mut R) -> Self

Generates random non-zero scalar

Algorithm is based on rejection sampling: we sample a scalar, if it’s zero try again. It may be considered constant-time as zero scalar appears with $2^{-256}$ probability which is considered to be negligible.

§Panics

Panics if randomness source returned 100 zero scalars in a row. It happens with $2^{-25600}$ probability, which practically means that randomness source is broken.

Source

pub fn from_hash<D: Digest>(data: &impl Digestable) -> Self

Available on crate feature hash-to-scalar only.

Hashes the input and outputs scalar

Input can be any structured data that implements Digestable trait (see udigest crate).

§How it works

It works by instantiating HashRng CSPRNG seeded from provided data. Then it’s used to derive the scalar.

§Security considerations

It’s not constant time. It doesn’t follow any existing standards for hash to scalar primitive.

§Example
use generic_ec::{Scalar, curves::Secp256k1};
use sha2::Sha256;

#[derive(udigest::Digestable)]
struct Data<'a> {
    nonce: &'a [u8],
    param_a: &'a str,
    param_b: u128,
    // ...
}

let scalar = Scalar::<Secp256k1>::from_hash::<Sha256>(&Data {
    nonce: b"some data",
    param_a: "some other data",
    param_b: 12345,
    // ...
});
Source

pub fn serialized_len() -> usize

Returns size of bytes buffer that can fit serialized scalar

Source

pub fn as_radix16_be(&self) -> Radix16Iter<E>

Returns scalar big-endian representation in radix $2^4 = 16$

Radix 16 representation is defined as sum:

$$s = s_0 + s_1 16^1 + s_2 16^2 + \dots + s_{\log_{16}(s) - 1} 16^{\log_{16}(s) - 1}$$

(note: we typically work with 256 bit scalars, so $\log_{16}(s) = \log_{16}(2^{256}) = 64$)

Returns iterator over coefficients from most to least significant: $s_{\log_{16}(s) - 1}, \dots, s_1, s_0$

Source

pub fn as_radix16_le(&self) -> Radix16Iter<E>

Returns scalar little-endian representation in radix $2^4 = 16$

Radix 16 representation is defined as sum:

$$s = s_0 + s_1 16^1 + s_2 16^2 + \dots + s_{\log_{16}(s) - 1} 16^{\log_{16}(s) - 1}$$

(note: we typically work with 256 bit scalars, so $\log_{16}(s) = \log_{16}(2^{256}) = 64$)

Returns iterator over coefficients from least to most significant: $s_0, s_1, \dots, s_{\log_{16}(s) - 1}$

Source

pub fn multiscalar_mul<S, P>( scalar_points: impl ExactSizeIterator<Item = (S, P)>, ) -> Point<E>
where S: AsRef<Scalar<E>>, P: AsRef<Point<E>>,

Performs multiscalar multiplication

Takes iterator of pairs (scalar, point). Returns sum of scalar * point. Uses Default algorithm.

See multiscalar module docs for more info.

Trait Implementations§

Source§

impl<E: Curve> Add<&NonZero<Scalar<E>>> for &Scalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &NonZero<Scalar<E>>) -> Self::Output

Performs the + operation. Read more
Source§

impl<E: Curve> Add<&NonZero<Scalar<E>>> for Scalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &NonZero<Scalar<E>>) -> Self::Output

Performs the + operation. Read more
Source§

impl<E: Curve> Add<&NonZero<SecretScalar<E>>> for &Scalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &NonZero<SecretScalar<E>>) -> Self::Output

Performs the + operation. Read more
Source§

impl<E: Curve> Add<&NonZero<SecretScalar<E>>> for Scalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &NonZero<SecretScalar<E>>) -> Self::Output

Performs the + operation. Read more
Source§

impl<E: Curve> Add<&Scalar<E>> for &NonZero<Scalar<E>>

Source§

type Output = Scalar<E>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &Scalar<E>) -> Self::Output

Performs the + operation. Read more
Source§

impl<E: Curve> Add<&Scalar<E>> for &NonZero<SecretScalar<E>>

Source§

type Output = Scalar<E>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &Scalar<E>) -> Self::Output

Performs the + operation. Read more
Source§

impl<E: Curve> Add<&Scalar<E>> for &Scalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &Scalar<E>) -> Self::Output

Performs the + operation. Read more
Source§

impl<E: Curve> Add<&Scalar<E>> for &SecretScalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &Scalar<E>) -> Self::Output

Performs the + operation. Read more
Source§

impl<E: Curve> Add<&Scalar<E>> for NonZero<Scalar<E>>

Source§

type Output = Scalar<E>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &Scalar<E>) -> Self::Output

Performs the + operation. Read more
Source§

impl<E: Curve> Add<&Scalar<E>> for NonZero<SecretScalar<E>>

Source§

type Output = Scalar<E>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &Scalar<E>) -> Self::Output

Performs the + operation. Read more
Source§

impl<E: Curve> Add<&Scalar<E>> for Scalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &Scalar<E>) -> Self::Output

Performs the + operation. Read more
Source§

impl<E: Curve> Add<&Scalar<E>> for SecretScalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &Scalar<E>) -> Self::Output

Performs the + operation. Read more
Source§

impl<E: Curve> Add<&SecretScalar<E>> for &Scalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &SecretScalar<E>) -> Self::Output

Performs the + operation. Read more
Source§

impl<E: Curve> Add<&SecretScalar<E>> for Scalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &SecretScalar<E>) -> Self::Output

Performs the + operation. Read more
Source§

impl<E: Curve> Add<NonZero<Scalar<E>>> for &Scalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: NonZero<Scalar<E>>) -> Self::Output

Performs the + operation. Read more
Source§

impl<E: Curve> Add<NonZero<Scalar<E>>> for Scalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: NonZero<Scalar<E>>) -> Self::Output

Performs the + operation. Read more
Source§

impl<E: Curve> Add<NonZero<SecretScalar<E>>> for &Scalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: NonZero<SecretScalar<E>>) -> Self::Output

Performs the + operation. Read more
Source§

impl<E: Curve> Add<NonZero<SecretScalar<E>>> for Scalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: NonZero<SecretScalar<E>>) -> Self::Output

Performs the + operation. Read more
Source§

impl<E: Curve> Add<Scalar<E>> for &NonZero<Scalar<E>>

Source§

type Output = Scalar<E>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Scalar<E>) -> Self::Output

Performs the + operation. Read more
Source§

impl<E: Curve> Add<Scalar<E>> for &NonZero<SecretScalar<E>>

Source§

type Output = Scalar<E>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Scalar<E>) -> Self::Output

Performs the + operation. Read more
Source§

impl<E: Curve> Add<Scalar<E>> for &Scalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Scalar<E>) -> Self::Output

Performs the + operation. Read more
Source§

impl<E: Curve> Add<Scalar<E>> for &SecretScalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Scalar<E>) -> Self::Output

Performs the + operation. Read more
Source§

impl<E: Curve> Add<Scalar<E>> for NonZero<Scalar<E>>

Source§

type Output = Scalar<E>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Scalar<E>) -> Self::Output

Performs the + operation. Read more
Source§

impl<E: Curve> Add<Scalar<E>> for NonZero<SecretScalar<E>>

Source§

type Output = Scalar<E>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Scalar<E>) -> Self::Output

Performs the + operation. Read more
Source§

impl<E: Curve> Add<Scalar<E>> for SecretScalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Scalar<E>) -> Self::Output

Performs the + operation. Read more
Source§

impl<E: Curve> Add<SecretScalar<E>> for &Scalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: SecretScalar<E>) -> Self::Output

Performs the + operation. Read more
Source§

impl<E: Curve> Add<SecretScalar<E>> for Scalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: SecretScalar<E>) -> Self::Output

Performs the + operation. Read more
Source§

impl<E: Curve> Add for Scalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Scalar<E>) -> Self::Output

Performs the + operation. Read more
Source§

impl<E: Curve> AddAssign<&NonZero<Scalar<E>>> for Scalar<E>

Source§

fn add_assign(&mut self, rhs: &NonZero<Scalar<E>>)

Performs the += operation. Read more
Source§

impl<E: Curve> AddAssign<&NonZero<SecretScalar<E>>> for Scalar<E>

Source§

fn add_assign(&mut self, rhs: &NonZero<SecretScalar<E>>)

Performs the += operation. Read more
Source§

impl<E: Curve> AddAssign<&Scalar<E>> for Scalar<E>

Source§

fn add_assign(&mut self, rhs: &Scalar<E>)

Performs the += operation. Read more
Source§

impl<E: Curve> AddAssign<&SecretScalar<E>> for Scalar<E>

Source§

fn add_assign(&mut self, rhs: &SecretScalar<E>)

Performs the += operation. Read more
Source§

impl<E: Curve> AddAssign<NonZero<Scalar<E>>> for Scalar<E>

Source§

fn add_assign(&mut self, rhs: NonZero<Scalar<E>>)

Performs the += operation. Read more
Source§

impl<E: Curve> AddAssign<NonZero<SecretScalar<E>>> for Scalar<E>

Source§

fn add_assign(&mut self, rhs: NonZero<SecretScalar<E>>)

Performs the += operation. Read more
Source§

impl<E: Curve> AddAssign<SecretScalar<E>> for Scalar<E>

Source§

fn add_assign(&mut self, rhs: SecretScalar<E>)

Performs the += operation. Read more
Source§

impl<E: Curve> AddAssign for Scalar<E>

Source§

fn add_assign(&mut self, rhs: Scalar<E>)

Performs the += operation. Read more
Source§

impl<E: Curve> AsRaw for Scalar<E>

Source§

type Raw = <E as Curve>::Scalar

Wrapped point/scalar
Source§

fn as_raw(&self) -> &E::Scalar

Returns reference to wrapped value
Source§

impl<E: Curve> AsRef<Scalar<E>> for NonZero<SecretScalar<E>>

Source§

fn as_ref(&self) -> &Scalar<E>

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<E: Curve> AsRef<Scalar<E>> for Scalar<E>

Source§

fn as_ref(&self) -> &Scalar<E>

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<E: Curve> AsRef<Scalar<E>> for SecretScalar<E>

Source§

fn as_ref(&self) -> &Scalar<E>

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<E: Clone + Curve> Clone for Scalar<E>
where E::Scalar: Clone,

Source§

fn clone(&self) -> Scalar<E>

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<E: Curve> ConditionallySelectable for Scalar<E>

Source§

fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self

Select a or b according to choice. Read more
Source§

fn conditional_assign(&mut self, other: &Self, choice: Choice)

Conditionally assign other to self, according to choice. Read more
Source§

fn conditional_swap(a: &mut Self, b: &mut Self, choice: Choice)

Conditionally swap self and other if choice == 1; otherwise, reassign both unto themselves. Read more
Source§

impl<E: Curve> ConstantTimeEq for Scalar<E>

Source§

fn ct_eq(&self, other: &Self) -> Choice

Determine if two items are equal. Read more
Source§

fn ct_ne(&self, other: &Self) -> Choice

Determine if two items are NOT equal. Read more
Source§

impl<E: Curve> Debug for Scalar<E>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<E: Default + Curve> Default for Scalar<E>
where E::Scalar: Default,

Source§

fn default() -> Scalar<E>

Returns the “default value” for a type. Read more
Source§

impl<'de, E: Curve> Deserialize<'de> for Scalar<E>

Available on crate feature serde only.
Source§

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<'de, E: Curve> DeserializeAs<'de, Scalar<E>> for Compact

Available on crate feature serde only.
Source§

fn deserialize_as<D>(deserializer: D) -> Result<Scalar<E>, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer.
Source§

impl<E: Curve> Digestable for Scalar<E>

Available on crate feature udigest only.
Source§

fn unambiguously_encode<B>(&self, encoder: EncodeValue<'_, B>)
where B: Buffer,

Unambiguously encodes the value
Source§

impl<E: Curve> From<NonZero<Scalar<E>>> for Scalar<E>

Source§

fn from(scalar: NonZero<Scalar<E>>) -> Self

Converts to this type from the input type.
Source§

impl<E: Curve> From<i128> for Scalar<E>

Source§

fn from(i: i128) -> Self

Converts to this type from the input type.
Source§

impl<E: Curve> From<i16> for Scalar<E>

Source§

fn from(i: i16) -> Self

Converts to this type from the input type.
Source§

impl<E: Curve> From<i32> for Scalar<E>

Source§

fn from(i: i32) -> Self

Converts to this type from the input type.
Source§

impl<E: Curve> From<i64> for Scalar<E>

Source§

fn from(i: i64) -> Self

Converts to this type from the input type.
Source§

impl<E: Curve> From<i8> for Scalar<E>

Source§

fn from(i: i8) -> Self

Converts to this type from the input type.
Source§

impl<E: Curve> From<u128> for Scalar<E>

Source§

fn from(i: u128) -> Self

Converts to this type from the input type.
Source§

impl<E: Curve> From<u16> for Scalar<E>

Source§

fn from(i: u16) -> Self

Converts to this type from the input type.
Source§

impl<E: Curve> From<u32> for Scalar<E>

Source§

fn from(i: u32) -> Self

Converts to this type from the input type.
Source§

impl<E: Curve> From<u64> for Scalar<E>

Source§

fn from(i: u64) -> Self

Converts to this type from the input type.
Source§

impl<E: Curve> From<u8> for Scalar<E>

Source§

fn from(i: u8) -> Self

Converts to this type from the input type.
Source§

impl<E: Curve> From<usize> for Scalar<E>

Source§

fn from(i: usize) -> Self

Converts to this type from the input type.
Source§

impl<E: Curve> FromRaw for Scalar<E>

Source§

fn from_raw(scalar: E::Scalar) -> Self

Infallibly wraps raw value
Source§

impl<E: Curve> Hash for Scalar<E>

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<E: Curve> IsZero for Scalar<E>

Source§

fn is_zero(&self) -> bool

Checks whether self is zero
Source§

impl<E: Curve> Mul<&Generator<E>> for &Scalar<E>

Source§

type Output = Point<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Generator<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<&Generator<E>> for Scalar<E>

Source§

type Output = Point<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Generator<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<&NonZero<Point<E>>> for &Scalar<E>

Source§

type Output = Point<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &NonZero<Point<E>>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<&NonZero<Point<E>>> for Scalar<E>

Source§

type Output = Point<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &NonZero<Point<E>>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<&NonZero<Scalar<E>>> for &Scalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &NonZero<Scalar<E>>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<&NonZero<Scalar<E>>> for Scalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &NonZero<Scalar<E>>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<&NonZero<SecretScalar<E>>> for &Scalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &NonZero<SecretScalar<E>>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<&NonZero<SecretScalar<E>>> for Scalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &NonZero<SecretScalar<E>>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<&Point<E>> for &Scalar<E>

Source§

type Output = Point<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Point<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<&Point<E>> for Scalar<E>

Source§

type Output = Point<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Point<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<&Scalar<E>> for &Generator<E>

Source§

type Output = Point<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Scalar<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<&Scalar<E>> for &NonZero<Point<E>>

Source§

type Output = Point<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Scalar<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<&Scalar<E>> for &NonZero<Scalar<E>>

Source§

type Output = Scalar<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Scalar<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<&Scalar<E>> for &NonZero<SecretScalar<E>>

Source§

type Output = Scalar<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Scalar<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<&Scalar<E>> for &Point<E>

Source§

type Output = Point<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Scalar<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<&Scalar<E>> for &Scalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Scalar<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<&Scalar<E>> for &SecretScalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Scalar<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<&Scalar<E>> for Generator<E>

Source§

type Output = Point<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Scalar<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<&Scalar<E>> for NonZero<Point<E>>

Source§

type Output = Point<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Scalar<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<&Scalar<E>> for NonZero<Scalar<E>>

Source§

type Output = Scalar<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Scalar<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<&Scalar<E>> for NonZero<SecretScalar<E>>

Source§

type Output = Scalar<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Scalar<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<&Scalar<E>> for Point<E>

Source§

type Output = Point<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Scalar<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<&Scalar<E>> for Scalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Scalar<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<&Scalar<E>> for SecretScalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Scalar<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<&SecretScalar<E>> for &Scalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &SecretScalar<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<&SecretScalar<E>> for Scalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &SecretScalar<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<Generator<E>> for &Scalar<E>

Source§

type Output = Point<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Generator<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<Generator<E>> for Scalar<E>

Source§

type Output = Point<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Generator<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<NonZero<Point<E>>> for &Scalar<E>

Source§

type Output = Point<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: NonZero<Point<E>>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<NonZero<Point<E>>> for Scalar<E>

Source§

type Output = Point<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: NonZero<Point<E>>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<NonZero<Scalar<E>>> for &Scalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: NonZero<Scalar<E>>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<NonZero<Scalar<E>>> for Scalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: NonZero<Scalar<E>>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<NonZero<SecretScalar<E>>> for &Scalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: NonZero<SecretScalar<E>>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<NonZero<SecretScalar<E>>> for Scalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: NonZero<SecretScalar<E>>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<Point<E>> for &Scalar<E>

Source§

type Output = Point<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Point<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<Point<E>> for Scalar<E>

Source§

type Output = Point<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Point<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<Scalar<E>> for &Generator<E>

Source§

type Output = Point<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Scalar<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<Scalar<E>> for &NonZero<Point<E>>

Source§

type Output = Point<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Scalar<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<Scalar<E>> for &NonZero<Scalar<E>>

Source§

type Output = Scalar<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Scalar<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<Scalar<E>> for &NonZero<SecretScalar<E>>

Source§

type Output = Scalar<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Scalar<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<Scalar<E>> for &Point<E>

Source§

type Output = Point<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Scalar<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<Scalar<E>> for &Scalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Scalar<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<Scalar<E>> for &SecretScalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Scalar<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<Scalar<E>> for Generator<E>

Source§

type Output = Point<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Scalar<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<Scalar<E>> for NonZero<Point<E>>

Source§

type Output = Point<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Scalar<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<Scalar<E>> for NonZero<Scalar<E>>

Source§

type Output = Scalar<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Scalar<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<Scalar<E>> for NonZero<SecretScalar<E>>

Source§

type Output = Scalar<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Scalar<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<Scalar<E>> for Point<E>

Source§

type Output = Point<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Scalar<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<Scalar<E>> for SecretScalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Scalar<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<SecretScalar<E>> for &Scalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: SecretScalar<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<SecretScalar<E>> for Scalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: SecretScalar<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul for Scalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Scalar<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> MulAssign<&NonZero<Scalar<E>>> for Scalar<E>

Source§

fn mul_assign(&mut self, rhs: &NonZero<Scalar<E>>)

Performs the *= operation. Read more
Source§

impl<E: Curve> MulAssign<&NonZero<SecretScalar<E>>> for Scalar<E>

Source§

fn mul_assign(&mut self, rhs: &NonZero<SecretScalar<E>>)

Performs the *= operation. Read more
Source§

impl<E: Curve> MulAssign<&Scalar<E>> for Point<E>

Source§

fn mul_assign(&mut self, rhs: &Scalar<E>)

Performs the *= operation. Read more
Source§

impl<E: Curve> MulAssign<&Scalar<E>> for Scalar<E>

Source§

fn mul_assign(&mut self, rhs: &Scalar<E>)

Performs the *= operation. Read more
Source§

impl<E: Curve> MulAssign<&SecretScalar<E>> for Scalar<E>

Source§

fn mul_assign(&mut self, rhs: &SecretScalar<E>)

Performs the *= operation. Read more
Source§

impl<E: Curve> MulAssign<NonZero<Scalar<E>>> for Scalar<E>

Source§

fn mul_assign(&mut self, rhs: NonZero<Scalar<E>>)

Performs the *= operation. Read more
Source§

impl<E: Curve> MulAssign<NonZero<SecretScalar<E>>> for Scalar<E>

Source§

fn mul_assign(&mut self, rhs: NonZero<SecretScalar<E>>)

Performs the *= operation. Read more
Source§

impl<E: Curve> MulAssign<Scalar<E>> for Point<E>

Source§

fn mul_assign(&mut self, rhs: Scalar<E>)

Performs the *= operation. Read more
Source§

impl<E: Curve> MulAssign<SecretScalar<E>> for Scalar<E>

Source§

fn mul_assign(&mut self, rhs: SecretScalar<E>)

Performs the *= operation. Read more
Source§

impl<E: Curve> MulAssign for Scalar<E>

Source§

fn mul_assign(&mut self, rhs: Scalar<E>)

Performs the *= operation. Read more
Source§

impl<E: Curve> Neg for &Scalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl<E: Curve> Neg for Scalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl<E: Curve> One for Scalar<E>

Source§

fn one() -> Self

Constructs one value of Self
Source§

fn is_one(x: &Self) -> Choice

Checks (in constant-time) if x is one
Source§

impl<E: Curve> Ord for Scalar<E>

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<E: Curve> PartialEq<NonZero<Scalar<E>>> for Scalar<E>

Source§

fn eq(&self, other: &NonZero<Scalar<E>>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

const fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<E: PartialEq + Curve> PartialEq for Scalar<E>
where E::Scalar: PartialEq,

Source§

fn eq(&self, other: &Scalar<E>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

const fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<E: Curve> PartialOrd<NonZero<Scalar<E>>> for Scalar<E>

Source§

fn partial_cmp(&self, other: &NonZero<Scalar<E>>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<E: Curve> PartialOrd for Scalar<E>

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<'a, E: Curve> Product<&'a Scalar<E>> for Scalar<E>

Source§

fn product<I: Iterator<Item = &'a Self>>(iter: I) -> Self

Takes an iterator and generates Self from the elements by multiplying the items.
Source§

impl<'s, E: Curve> Product<&'s SecretScalar<E>> for Scalar<E>

Source§

fn product<I: Iterator<Item = &'s SecretScalar<E>>>(iter: I) -> Self

Takes an iterator and generates Self from the elements by multiplying the items.
Source§

impl<E: Curve> Product<SecretScalar<E>> for Scalar<E>

Source§

fn product<I: Iterator<Item = SecretScalar<E>>>(iter: I) -> Self

Takes an iterator and generates Self from the elements by multiplying the items.
Source§

impl<E: Curve> Product for Scalar<E>

Source§

fn product<I: Iterator<Item = Self>>(iter: I) -> Self

Takes an iterator and generates Self from the elements by multiplying the items.
Source§

impl<E: Curve, const N: usize> Reduce<N> for Scalar<E>
where E::Scalar: Reduce<N>,

Source§

fn from_be_array_mod_order(bytes: &[u8; N]) -> Self

Interprets bytes as big-endian encoding of an integer, returns this integer modulo curve (prime) order
Source§

fn from_le_array_mod_order(bytes: &[u8; N]) -> Self

Interprets bytes as little-endian encoding of an integer, returns this integer modulo curve (prime) order
Source§

impl<E: Curve> Samplable for Scalar<E>

Source§

fn random<R: RngCore>(rng: &mut R) -> Self

Uniformely samples a random value of Self
Source§

impl<E: Curve> Serialize for Scalar<E>

Available on crate feature serde only.
Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<E: Curve> SerializeAs<Scalar<E>> for Compact

Available on crate feature serde only.
Source§

fn serialize_as<S>(source: &Scalar<E>, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer.
Source§

impl<E: Curve> Sub<&NonZero<Scalar<E>>> for &Scalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &NonZero<Scalar<E>>) -> Self::Output

Performs the - operation. Read more
Source§

impl<E: Curve> Sub<&NonZero<Scalar<E>>> for Scalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &NonZero<Scalar<E>>) -> Self::Output

Performs the - operation. Read more
Source§

impl<E: Curve> Sub<&NonZero<SecretScalar<E>>> for &Scalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &NonZero<SecretScalar<E>>) -> Self::Output

Performs the - operation. Read more
Source§

impl<E: Curve> Sub<&NonZero<SecretScalar<E>>> for Scalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &NonZero<SecretScalar<E>>) -> Self::Output

Performs the - operation. Read more
Source§

impl<E: Curve> Sub<&Scalar<E>> for &NonZero<Scalar<E>>

Source§

type Output = Scalar<E>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &Scalar<E>) -> Self::Output

Performs the - operation. Read more
Source§

impl<E: Curve> Sub<&Scalar<E>> for &NonZero<SecretScalar<E>>

Source§

type Output = Scalar<E>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &Scalar<E>) -> Self::Output

Performs the - operation. Read more
Source§

impl<E: Curve> Sub<&Scalar<E>> for &Scalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &Scalar<E>) -> Self::Output

Performs the - operation. Read more
Source§

impl<E: Curve> Sub<&Scalar<E>> for &SecretScalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &Scalar<E>) -> Self::Output

Performs the - operation. Read more
Source§

impl<E: Curve> Sub<&Scalar<E>> for NonZero<Scalar<E>>

Source§

type Output = Scalar<E>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &Scalar<E>) -> Self::Output

Performs the - operation. Read more
Source§

impl<E: Curve> Sub<&Scalar<E>> for NonZero<SecretScalar<E>>

Source§

type Output = Scalar<E>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &Scalar<E>) -> Self::Output

Performs the - operation. Read more
Source§

impl<E: Curve> Sub<&Scalar<E>> for Scalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &Scalar<E>) -> Self::Output

Performs the - operation. Read more
Source§

impl<E: Curve> Sub<&Scalar<E>> for SecretScalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &Scalar<E>) -> Self::Output

Performs the - operation. Read more
Source§

impl<E: Curve> Sub<&SecretScalar<E>> for &Scalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &SecretScalar<E>) -> Self::Output

Performs the - operation. Read more
Source§

impl<E: Curve> Sub<&SecretScalar<E>> for Scalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &SecretScalar<E>) -> Self::Output

Performs the - operation. Read more
Source§

impl<E: Curve> Sub<NonZero<Scalar<E>>> for &Scalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: NonZero<Scalar<E>>) -> Self::Output

Performs the - operation. Read more
Source§

impl<E: Curve> Sub<NonZero<Scalar<E>>> for Scalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: NonZero<Scalar<E>>) -> Self::Output

Performs the - operation. Read more
Source§

impl<E: Curve> Sub<NonZero<SecretScalar<E>>> for &Scalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: NonZero<SecretScalar<E>>) -> Self::Output

Performs the - operation. Read more
Source§

impl<E: Curve> Sub<NonZero<SecretScalar<E>>> for Scalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: NonZero<SecretScalar<E>>) -> Self::Output

Performs the - operation. Read more
Source§

impl<E: Curve> Sub<Scalar<E>> for &NonZero<Scalar<E>>

Source§

type Output = Scalar<E>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Scalar<E>) -> Self::Output

Performs the - operation. Read more
Source§

impl<E: Curve> Sub<Scalar<E>> for &NonZero<SecretScalar<E>>

Source§

type Output = Scalar<E>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Scalar<E>) -> Self::Output

Performs the - operation. Read more
Source§

impl<E: Curve> Sub<Scalar<E>> for &Scalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Scalar<E>) -> Self::Output

Performs the - operation. Read more
Source§

impl<E: Curve> Sub<Scalar<E>> for &SecretScalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Scalar<E>) -> Self::Output

Performs the - operation. Read more
Source§

impl<E: Curve> Sub<Scalar<E>> for NonZero<Scalar<E>>

Source§

type Output = Scalar<E>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Scalar<E>) -> Self::Output

Performs the - operation. Read more
Source§

impl<E: Curve> Sub<Scalar<E>> for NonZero<SecretScalar<E>>

Source§

type Output = Scalar<E>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Scalar<E>) -> Self::Output

Performs the - operation. Read more
Source§

impl<E: Curve> Sub<Scalar<E>> for SecretScalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Scalar<E>) -> Self::Output

Performs the - operation. Read more
Source§

impl<E: Curve> Sub<SecretScalar<E>> for &Scalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: SecretScalar<E>) -> Self::Output

Performs the - operation. Read more
Source§

impl<E: Curve> Sub<SecretScalar<E>> for Scalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: SecretScalar<E>) -> Self::Output

Performs the - operation. Read more
Source§

impl<E: Curve> Sub for Scalar<E>

Source§

type Output = Scalar<E>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Scalar<E>) -> Self::Output

Performs the - operation. Read more
Source§

impl<E: Curve> SubAssign<&NonZero<Scalar<E>>> for Scalar<E>

Source§

fn sub_assign(&mut self, rhs: &NonZero<Scalar<E>>)

Performs the -= operation. Read more
Source§

impl<E: Curve> SubAssign<&NonZero<SecretScalar<E>>> for Scalar<E>

Source§

fn sub_assign(&mut self, rhs: &NonZero<SecretScalar<E>>)

Performs the -= operation. Read more
Source§

impl<E: Curve> SubAssign<&Scalar<E>> for Scalar<E>

Source§

fn sub_assign(&mut self, rhs: &Scalar<E>)

Performs the -= operation. Read more
Source§

impl<E: Curve> SubAssign<&SecretScalar<E>> for Scalar<E>

Source§

fn sub_assign(&mut self, rhs: &SecretScalar<E>)

Performs the -= operation. Read more
Source§

impl<E: Curve> SubAssign<NonZero<Scalar<E>>> for Scalar<E>

Source§

fn sub_assign(&mut self, rhs: NonZero<Scalar<E>>)

Performs the -= operation. Read more
Source§

impl<E: Curve> SubAssign<NonZero<SecretScalar<E>>> for Scalar<E>

Source§

fn sub_assign(&mut self, rhs: NonZero<SecretScalar<E>>)

Performs the -= operation. Read more
Source§

impl<E: Curve> SubAssign<SecretScalar<E>> for Scalar<E>

Source§

fn sub_assign(&mut self, rhs: SecretScalar<E>)

Performs the -= operation. Read more
Source§

impl<E: Curve> SubAssign for Scalar<E>

Source§

fn sub_assign(&mut self, rhs: Scalar<E>)

Performs the -= operation. Read more
Source§

impl<'s, E: Curve> Sum<&'s NonZero<Scalar<E>>> for Scalar<E>

Source§

fn sum<I: Iterator<Item = &'s NonZero<Scalar<E>>>>(iter: I) -> Self

Takes an iterator and generates Self from the elements by “summing up” the items.
Source§

impl<'a, E: Curve> Sum<&'a Scalar<E>> for Scalar<E>

Source§

fn sum<I: Iterator<Item = &'a Self>>(iter: I) -> Self

Takes an iterator and generates Self from the elements by “summing up” the items.
Source§

impl<'s, E: Curve> Sum<&'s SecretScalar<E>> for Scalar<E>

Source§

fn sum<I: Iterator<Item = &'s SecretScalar<E>>>(iter: I) -> Self

Takes an iterator and generates Self from the elements by “summing up” the items.
Source§

impl<E: Curve> Sum<NonZero<Scalar<E>>> for Scalar<E>

Source§

fn sum<I: Iterator<Item = NonZero<Scalar<E>>>>(iter: I) -> Self

Takes an iterator and generates Self from the elements by “summing up” the items.
Source§

impl<E: Curve> Sum<SecretScalar<E>> for Scalar<E>

Source§

fn sum<I: Iterator<Item = SecretScalar<E>>>(iter: I) -> Self

Takes an iterator and generates Self from the elements by “summing up” the items.
Source§

impl<E: Curve> Sum for Scalar<E>

Source§

fn sum<I: Iterator<Item = Self>>(iter: I) -> Self

Takes an iterator and generates Self from the elements by “summing up” the items.
Source§

impl<E: Curve> TryFrom<Scalar<E>> for NonZero<Scalar<E>>

Source§

type Error = ZeroScalar

The type returned in the event of a conversion error.
Source§

fn try_from(scalar: Scalar<E>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<E: Curve> Zero for Scalar<E>

Source§

fn zero() -> Self

Constructs zero value of Self
Source§

fn is_zero(x: &Self) -> Choice

Checks (in constant-time) if x is zero
Source§

impl<E: Curve> Zeroize for Scalar<E>

Source§

fn zeroize(&mut self)

Zero out this object from memory using Rust intrinsics which ensure the zeroization operation is not “optimized away” by the compiler.
Source§

impl<E: Copy + Curve> Copy for Scalar<E>
where E::Scalar: Copy,

Source§

impl<E: Eq + Curve> Eq for Scalar<E>
where E::Scalar: Eq,

Source§

impl<E: Curve> StructuralPartialEq for Scalar<E>

Auto Trait Implementations§

§

impl<E> Freeze for Scalar<E>
where <E as Curve>::Scalar: Freeze,

§

impl<E> RefUnwindSafe for Scalar<E>
where <E as Curve>::Scalar: RefUnwindSafe,

§

impl<E> Send for Scalar<E>

§

impl<E> Sync for Scalar<E>

§

impl<E> Unpin for Scalar<E>

§

impl<E> UnwindSafe for Scalar<E>
where <E as Curve>::Scalar: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

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

Source§

fn conditional_negate(&mut self, choice: Choice)

Negate self if choice == Choice(1); otherwise, leave it unchanged. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

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

Source§

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

Source§

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

Source§

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