Struct SecretScalar

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

Scalar representing sensitive information (like secret key)

Secret scalar should be treated with an extra care. You shouldn’t do any branching (e.g. Eq, Ord) on the secret to avoid timing side-channel attacks, so it implements only constant time traits (like ConstantTimeEq).

Also, when alloc feature is enabled, we enforce extra measures:

  • Secret scalar leaves no trace in RAM after it’s dropped
    Memory is zeroized after use
  • All clones of secret scalar refer to the same region in the memory
    I.e. there will always be only one instance of the scalar in the memory no matter how many clones you make

All these guarantees can be bypassed by calling .as_ref() and obtaining &Scalar<E> that is not protected from timing attacks, leaving traces in the memory, etc.

Implementations§

Source§

impl<E: Curve> SecretScalar<E>

Source

pub fn new(scalar: &mut Scalar<E>) -> Self

Constructs a new secret scalar

It takes original scalar by mutable reference instead of taking by value to avoid leaving copies of scalar on stack. Scalar behind the reference will be zeroized after function returned.

Source§

impl<E: Curve> SecretScalar<E>

Source

pub fn zero() -> Self

Returns scalar $S = 0$

Source

pub fn one() -> Self

Returns scalar $S = 1$

Source

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

Returns scalar inverse

Source

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

Generates random secret scalar

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::{SecretScalar, curves::Secp256k1};
use sha2::Sha256;

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

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

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

Decodes scalar from its bytes representation in big-endian order

Source

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

Decodes scalar from its bytes representation in little-endian order

Trait Implementations§

Source§

impl<E: Curve> Add<&NonZero<Scalar<E>>> for &SecretScalar<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 SecretScalar<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 &SecretScalar<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 SecretScalar<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 &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 &NonZero<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 &NonZero<SecretScalar<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<&SecretScalar<E>> for NonZero<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 NonZero<SecretScalar<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 &SecretScalar<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 SecretScalar<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 &SecretScalar<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 SecretScalar<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 &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 &NonZero<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 &NonZero<SecretScalar<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<SecretScalar<E>> for NonZero<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 NonZero<SecretScalar<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> 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<SecretScalar<E>> for Scalar<E>

Source§

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

Performs the += operation. Read more
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: Curve> Clone for SecretScalar<E>

Source§

fn clone(&self) -> Self

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> ConstantTimeEq for SecretScalar<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 SecretScalar<E>

Source§

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

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

impl<'de, E: Curve> Deserialize<'de> for SecretScalar<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, SecretScalar<E>> for Compact

Available on crate feature serde only.
Source§

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

Deserialize this value from the given Serde deserializer.
Source§

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

Source§

fn from(secret_scalar: NonZero<SecretScalar<E>>) -> Self

Converts to this type from the input type.
Source§

impl<E: Curve> Mul<&Generator<E>> for &SecretScalar<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 SecretScalar<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 &SecretScalar<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 SecretScalar<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 &SecretScalar<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 SecretScalar<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<&Point<E>> for &SecretScalar<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 SecretScalar<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 &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 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 &Generator<E>

Source§

type Output = Point<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 &NonZero<Point<E>>

Source§

type Output = Point<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 &NonZero<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 &Point<E>

Source§

type Output = Point<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<&SecretScalar<E>> for Generator<E>

Source§

type Output = Point<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 NonZero<Point<E>>

Source§

type Output = Point<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 NonZero<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 Point<E>

Source§

type Output = Point<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 &SecretScalar<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 SecretScalar<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 &SecretScalar<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 SecretScalar<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 &SecretScalar<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 SecretScalar<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<Point<E>> for &SecretScalar<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 SecretScalar<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 &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 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 &Generator<E>

Source§

type Output = Point<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 &NonZero<Point<E>>

Source§

type Output = Point<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 &NonZero<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 &Point<E>

Source§

type Output = Point<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<SecretScalar<E>> for Generator<E>

Source§

type Output = Point<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 NonZero<Point<E>>

Source§

type Output = Point<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 NonZero<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 Point<E>

Source§

type Output = Point<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> MulAssign<&SecretScalar<E>> for Point<E>

Source§

fn mul_assign(&mut self, rhs: &SecretScalar<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<SecretScalar<E>> for Point<E>

Source§

fn mul_assign(&mut self, rhs: SecretScalar<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<'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> Samplable for SecretScalar<E>

Source§

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

Uniformely samples a random value of Self
Source§

impl<E: Curve> Serialize for SecretScalar<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<SecretScalar<E>> for Compact

Available on crate feature serde only.
Source§

fn serialize_as<S>( source: &SecretScalar<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 &SecretScalar<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 SecretScalar<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 &SecretScalar<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 SecretScalar<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 &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 &NonZero<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 &NonZero<SecretScalar<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<&SecretScalar<E>> for NonZero<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 NonZero<SecretScalar<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 &SecretScalar<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 SecretScalar<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 &SecretScalar<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 SecretScalar<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 &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 &NonZero<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 &NonZero<SecretScalar<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<SecretScalar<E>> for NonZero<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 NonZero<SecretScalar<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> 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<SecretScalar<E>> for Scalar<E>

Source§

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

Performs the -= operation. Read more
Source§

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

Source§

fn sum<I: Iterator<Item = &'s NonZero<SecretScalar<E>>>>(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<SecretScalar<E>>> for SecretScalar<E>

Source§

fn sum<I: Iterator<Item = NonZero<SecretScalar<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> TryFrom<SecretScalar<E>> for NonZero<SecretScalar<E>>

Source§

type Error = ZeroScalar

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

fn try_from(secret_scalar: SecretScalar<E>) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

§

impl<E> Freeze for SecretScalar<E>

§

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

§

impl<E> Send for SecretScalar<E>

§

impl<E> Sync for SecretScalar<E>

§

impl<E> Unpin for SecretScalar<E>

§

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

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