pub struct BasepointTable<Point, const WINDOW_SIZE: usize> {
tables: LazyLock<[LookupTable<Point>; WINDOW_SIZE]>,
}Expand description
Precomputed lookup table of multiples of a base point, a.k.a. generator.
This type leverages lazy computation, and requires one of the following crate features to be enabled in order to work:
std: leveragesstd::sync::LazyLockcritical-section: leveragesonce_cell::sync::Lazyvia thecritical-sectioncrate, enabling the feature to be used inno_stdcontexts.
Fields§
§tables: LazyLock<[LookupTable<Point>; WINDOW_SIZE]>Implementations§
Source§impl<Point, const WINDOW_SIZE: usize> BasepointTable<Point, WINDOW_SIZE>
impl<Point, const WINDOW_SIZE: usize> BasepointTable<Point, WINDOW_SIZE>
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Create a new BasepointTable which is lazily initialized on first use and can be bound
to a constant.
Computed using the Point’s Group::generator as the base point.
Source§impl<C: PrimeCurveParams, const WINDOW_SIZE: usize> BasepointTable<ProjectivePoint<C>, WINDOW_SIZE>
impl<C: PrimeCurveParams, const WINDOW_SIZE: usize> BasepointTable<ProjectivePoint<C>, WINDOW_SIZE>
Sourcepub fn mul(&self, k: &Scalar<C>) -> ProjectivePoint<C>
pub fn mul(&self, k: &Scalar<C>) -> ProjectivePoint<C>
Multiply Point::generator by the given scalar in constant-time, using the precomputed
basepoint table to accelerate the scalar multiplication.
Sourcepub fn mul_vartime(&self, k: &Scalar<C>) -> ProjectivePoint<C>
pub fn mul_vartime(&self, k: &Scalar<C>) -> ProjectivePoint<C>
Multiply Point::generator by the given scalar in constant-time, using the precomputed
basepoint table to accelerate the scalar multiplication.
Security Warning
Variable-time scalar multiplication can potentially leak secret values and should NOT be used with them.
Trait Implementations§
Source§impl<Point, const WINDOW_SIZE: usize> Default for BasepointTable<Point, WINDOW_SIZE>
impl<Point, const WINDOW_SIZE: usize> Default for BasepointTable<Point, WINDOW_SIZE>
Source§impl<Point, const WINDOW_SIZE: usize> Deref for BasepointTable<Point, WINDOW_SIZE>
impl<Point, const WINDOW_SIZE: usize> Deref for BasepointTable<Point, WINDOW_SIZE>
Source§type Target = [LookupTable<Point>; WINDOW_SIZE]
type Target = [LookupTable<Point>; WINDOW_SIZE]
The resulting type after dereferencing.
Source§fn deref(&self) -> &[LookupTable<Point>; WINDOW_SIZE]
fn deref(&self) -> &[LookupTable<Point>; WINDOW_SIZE]
Dereferences the value.
Auto Trait Implementations§
impl<Point, const WINDOW_SIZE: usize> !Freeze for BasepointTable<Point, WINDOW_SIZE>
impl<Point, const WINDOW_SIZE: usize> RefUnwindSafe for BasepointTable<Point, WINDOW_SIZE>where
Point: RefUnwindSafe + UnwindSafe,
impl<Point, const WINDOW_SIZE: usize> Send for BasepointTable<Point, WINDOW_SIZE>where
Point: Send,
impl<Point, const WINDOW_SIZE: usize> Sync for BasepointTable<Point, WINDOW_SIZE>
impl<Point, const WINDOW_SIZE: usize> Unpin for BasepointTable<Point, WINDOW_SIZE>where
Point: Unpin,
impl<Point, const WINDOW_SIZE: usize> UnsafeUnpin for BasepointTable<Point, WINDOW_SIZE>where
Point: UnsafeUnpin,
impl<Point, const WINDOW_SIZE: usize> UnwindSafe for BasepointTable<Point, WINDOW_SIZE>where
Point: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more