Skip to main content

BasepointTable

Struct BasepointTable 

Source
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: leverages std::sync::LazyLock
  • critical-section: leverages once_cell::sync::Lazy via the critical-section crate, enabling the feature to be used in no_std contexts.

Fields§

§tables: LazyLock<[LookupTable<Point>; WINDOW_SIZE]>

Implementations§

Source§

impl<Point, const WINDOW_SIZE: usize> BasepointTable<Point, WINDOW_SIZE>

Source

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>

Source

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.

Source

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: Debug, const WINDOW_SIZE: usize> Debug for BasepointTable<Point, WINDOW_SIZE>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<Point, const WINDOW_SIZE: usize> Default for BasepointTable<Point, WINDOW_SIZE>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<Point, const WINDOW_SIZE: usize> Deref for BasepointTable<Point, WINDOW_SIZE>

Source§

type Target = [LookupTable<Point>; WINDOW_SIZE]

The resulting type after dereferencing.
Source§

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>
where Point: Sync + Send,

§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.