pub trait Group:
Clone
+ Copy
+ Debug
+ Eq
+ Sized
+ Send
+ Sync
+ 'static
+ Sum
+ for<'a> Sum<&'a Self>
+ Neg<Output = Self>
+ GroupOps
+ GroupOpsOwned
+ ScalarMul<Self::Scalar>
+ ScalarMulOwned<Self::Scalar> {
type Scalar: PrimeField;
// Required methods
fn try_from_rng<R: TryRng + ?Sized>(rng: &mut R) -> Result<Self, R::Error>;
fn identity() -> Self;
fn generator() -> Self;
fn is_identity(&self) -> Choice;
fn double(&self) -> Self;
// Provided methods
fn random<R: Rng + ?Sized>(rng: &mut R) -> Self { ... }
fn mul_by_generator(scalar: &Self::Scalar) -> Self { ... }
}Expand description
This trait represents an element of a cryptographic group.
Required Associated Types§
Sourcetype Scalar: PrimeField
type Scalar: PrimeField
Scalars modulo the order of this group’s scalar field.
Required Methods§
Sourcefn try_from_rng<R: TryRng + ?Sized>(rng: &mut R) -> Result<Self, R::Error>
fn try_from_rng<R: TryRng + ?Sized>(rng: &mut R) -> Result<Self, R::Error>
Returns an element chosen uniformly at random from the non-identity elements of this group.
This function is non-deterministic, and samples from the user-provided RNG.
Sourcefn is_identity(&self) -> Choice
fn is_identity(&self) -> Choice
Determines if this point is the identity.
Provided Methods§
Sourcefn random<R: Rng + ?Sized>(rng: &mut R) -> Self
fn random<R: Rng + ?Sized>(rng: &mut R) -> Self
Returns an element chosen uniformly at random from the non-identity elements of this group.
This function is non-deterministic, and samples from the user-provided RNG.
Sourcefn mul_by_generator(scalar: &Self::Scalar) -> Self
fn mul_by_generator(scalar: &Self::Scalar) -> Self
Multiply by the generator of the prime-order subgroup.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.