1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#![allow(non_snake_case)]
use traits::Identity;
use scalar::Scalar;
use edwards::EdwardsPoint;
use backend::serial::curve_models::{ProjectiveNielsPoint, ProjectivePoint};
use window::LookupTable;
pub(crate) fn mul(point: &EdwardsPoint, scalar: &Scalar) -> EdwardsPoint {
let lookup_table = LookupTable::<ProjectiveNielsPoint>::from(point);
let scalar_digits = scalar.to_radix_16();
let mut tmp2;
let mut tmp3 = EdwardsPoint::identity();
let mut tmp1 = &tmp3 + &lookup_table.select(scalar_digits[63]);
for i in (0..63).rev() {
tmp2 = tmp1.to_projective();
tmp1 = tmp2.double();
tmp2 = tmp1.to_projective();
tmp1 = tmp2.double();
tmp2 = tmp1.to_projective();
tmp1 = tmp2.double();
tmp2 = tmp1.to_projective();
tmp1 = tmp2.double();
tmp3 = tmp1.to_extended();
tmp1 = &tmp3 + &lookup_table.select(scalar_digits[i]);
}
tmp1.to_extended()
}