Skip to content

Commit b4e8749

Browse files
committed
Add Group::mul_by_generator
Adds a provided method to the `Group` trait for performing multiplication by the generator. The use case is overriding this method in the event that precomputed scalar multiplication tables are available, which may be conditional depending on crate features like `alloc` or feature-gated static precomputed tables.
1 parent 090a7ec commit b4e8749

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@ pub trait Group:
9090
/// Doubles this element.
9191
#[must_use]
9292
fn double(&self) -> Self;
93+
94+
/// Multiply by the generator of the prime-order subgroup.
95+
#[must_use]
96+
fn mul_by_generator(scalar: &Self::Scalar) -> Self {
97+
Self::generator() * scalar
98+
}
9399
}
94100

95101
/// Efficient representation of an elliptic curve point guaranteed.

0 commit comments

Comments
 (0)