Trait group::cofactor::CofactorGroup
source · pub trait CofactorGroup: Group + GroupEncoding + GroupOps<Self::Subgroup> + GroupOpsOwned<Self::Subgroup> {
type Subgroup: PrimeGroup<Scalar = Self::Scalar> + Into<Self>;
// Required methods
fn clear_cofactor(&self) -> Self::Subgroup;
fn into_subgroup(self) -> CtOption<Self::Subgroup>;
fn is_torsion_free(&self) -> Choice;
// Provided method
fn is_small_order(&self) -> Choice { ... }
}
Expand description
This trait represents an element of a cryptographic group with a large prime-order subgroup and a comparatively-small cofactor.
Required Associated Types§
sourcetype Subgroup: PrimeGroup<Scalar = Self::Scalar> + Into<Self>
type Subgroup: PrimeGroup<Scalar = Self::Scalar> + Into<Self>
The large prime-order subgroup in which cryptographic operations are performed.
If Self
implements PrimeGroup
, then Self::Subgroup
may be Self
.
Required Methods§
sourcefn clear_cofactor(&self) -> Self::Subgroup
fn clear_cofactor(&self) -> Self::Subgroup
Maps self
to the prime-order subgroup by multiplying this element by some
k
-multiple of the cofactor.
The value k
does not vary between inputs for a given implementation, but may
vary between different implementations of CofactorGroup
because some groups have
more efficient methods of clearing the cofactor when k
is allowed to be
different than 1
.
If Self
implements PrimeGroup
, this returns self
.
sourcefn into_subgroup(self) -> CtOption<Self::Subgroup>
fn into_subgroup(self) -> CtOption<Self::Subgroup>
Returns self
if it is contained in the prime-order subgroup.
If Self
implements PrimeGroup
, this returns Some(self)
.
sourcefn is_torsion_free(&self) -> Choice
fn is_torsion_free(&self) -> Choice
Determines if this element is “torsion free”, i.e., is contained in the prime-order subgroup.
Returns:
true
ifself
has trivial torsion and is in the prime-order subgroup.false
ifself
has non-zero torsion component and is not in the prime-order subgroup.
Provided Methods§
sourcefn is_small_order(&self) -> Choice
fn is_small_order(&self) -> Choice
Determines if this element is of small order.
Returns:
true
ifself
is in the torsion subgroup.false
ifself
is not in the torsion subgroup.