mirror of
https://github.com/saymrwulf/betrusted-curve25519-dalek-source.git
synced 2026-09-05 20:30:54 +00:00
Add a trait for implementing a basepoint table.
This commit is contained in:
parent
4f29935c2c
commit
383e65f6bd
1 changed files with 15 additions and 0 deletions
|
|
@ -47,6 +47,21 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
/// A precomputed table of basepoints, for optimising scalar multiplications.
|
||||
pub trait BasepointTable {
|
||||
/// The type of point contained within this table.
|
||||
type Point;
|
||||
|
||||
/// Generate a new precomputed basepoint table from the given basepoint.
|
||||
fn create(basepoint: &Self::Point) -> Self;
|
||||
|
||||
/// Retrieve the original basepoint from this table.
|
||||
fn basepoint(&self) -> Self::Point;
|
||||
|
||||
/// Multiply a `scalar` by this precomputed basepoint table, in constant time.
|
||||
fn basepoint_mul(&self, scalar: &Scalar) -> Self::Point;
|
||||
}
|
||||
|
||||
/// A trait for constant-time multiscalar multiplication without precomputation.
|
||||
pub trait MultiscalarMul {
|
||||
/// The type of point being multiplied, e.g., `RistrettoPoint`.
|
||||
|
|
|
|||
Loading…
Reference in a new issue