Struct curve25519_dalek::edwards::EdwardsBasepointTable
[−]
[src]
pub struct EdwardsBasepointTable(pub [[AffineNielsPoint; 8]; 32]);
Precomputation
Methods
impl EdwardsBasepointTable
[src]
fn create(basepoint: &ExtendedPoint) -> EdwardsBasepointTable
[src]
Create a table of precomputed multiples of basepoint
.
fn basepoint(&self) -> ExtendedPoint
[src]
Get the basepoint for this table as an ExtendedPoint
.
Trait Implementations
impl Clone for EdwardsBasepointTable
[src]
fn clone(&self) -> EdwardsBasepointTable
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<'a, 'b> Mul<&'b Scalar> for &'a EdwardsBasepointTable
[src]
type Output = ExtendedPoint
The resulting type after applying the *
operator.
fn mul(self, scalar: &'b Scalar) -> ExtendedPoint
[src]
Construct an ExtendedPoint
from a Scalar
, scalar
, by
computing the multiple aB
of the basepoint B
.
Precondition: the scalar must be reduced.
The computation proceeds as follows, as described on page 13
of the Ed25519 paper. Write the scalar a
in radix 16 with
coefficients in [-8,8), i.e.,
a = a_0 + a_1*161 + ... + a_63*1663,
with -8 ≤ a_i < 8. Then
a*B = a_0*B + a_1*161*B + ... + a_63*1663*B.
Grouping even and odd coefficients gives
a*B = a_0*160*B + a_2*162*B + ... + a_62*1662*B + a_1*161*B + a_3*163*B + ... + a_63*1663*B = (a_0*160*B + a_2*162*B + ... + a_62*1662*B) + 16*(a_1*160*B + a_3*162*B + ... + a_63*1662*B).
We then use the select_precomputed_point
function, which
takes -8 ≤ x < 8
and [16^2i * B, ..., 8 * 16^2i * B]
,
and returns x * 16^2i * B
in constant time.