p521/arithmetic/
tables.rs1use super::NistP521;
4use crate::ProjectivePoint;
5use primeorder::PrimeCurveWithBasepointTable;
6
7pub(super) const WINDOW_SIZE: usize = 67;
9
10pub(super) type BasepointTable = primeorder::BasepointTable<ProjectivePoint, WINDOW_SIZE>;
12
13pub(super) static BASEPOINT_TABLE: BasepointTable = BasepointTable::new();
15
16impl PrimeCurveWithBasepointTable<WINDOW_SIZE> for NistP521 {
17 const BASEPOINT_TABLE: &'static BasepointTable = &BASEPOINT_TABLE;
18}
19
20pub(crate) mod backend {
25 use super::BASEPOINT_TABLE;
26 use crate::{NistP521, ProjectivePoint, Scalar};
27 use primeorder::MulBackend;
28
29 pub struct PrecomputedTables;
31
32 impl MulBackend<NistP521> for PrecomputedTables {
33 #[inline]
34 fn mul_by_generator(k: &Scalar) -> ProjectivePoint {
35 BASEPOINT_TABLE.mul(k)
36 }
37
38 #[inline]
39 fn mul_by_generator_vartime(k: &Scalar) -> ProjectivePoint {
40 BASEPOINT_TABLE.mul_vartime(k)
41 }
42 }
43}