Skip to content

Commit

Permalink
Avoid batch affine conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
randombit committed Apr 10, 2024
1 parent 2625908 commit 16e773e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/lib/pubkey/pcurves/pcurves_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,7 @@ class PrecomputedMulTable {
static const constinit size_t TABLE_SIZE = Scalar::BITS;

constexpr PrecomputedMulTable(const AffinePoint& p) : m_table{} {
#if 0
std::array<ProjectivePoint, TABLE_SIZE> table;

table[0] = ProjectivePoint::from_affine(p);
Expand All @@ -689,6 +690,13 @@ class PrecomputedMulTable {
}

m_table = ProjectivePoint::to_affine_batch(table);
#else
auto pt = ProjectivePoint::from_affine(p);
for(size_t i = 0; i != TABLE_SIZE; ++i) {
m_table[i] = pt.to_affine();
pt = pt.dbl();
}
#endif
}

constexpr ProjectivePoint operator()(const Scalar& s) const {
Expand Down

0 comments on commit 16e773e

Please sign in to comment.