This note explains the scalar decomposition step on the efficient EC multiplication algorithm proposed in this article.
Some implementations of the algorithm:
Here is a good explanation of the whole algorithm along with an implementation: bitcoin secp impl.
The following homomorphism is defined: where is the endoscalar of the curve.
The problem of decomposing a given scalar consists of finding a pair s.t. . The key of the problem is to find the shortest vector possible that satisfies this relation.
First we precompute 2 vectors such that .
The problem now turns into finding a vector in the lattice generated by that is close to .
With such vector we easily compute
which is short, ()
and satisfies our fist condition, since
Let .
We solve the system
where is the determinant of the matrix.
We get
Due to the determinant division, these values lie on . We round them to their closest integer value to obtain a point in the -generated lattice. Now we have:
We will only compute : Then we use the original definition to compute :
Finally, instead of returning , this algorithm will return or choosing the one with a lower absolute value. The choice is indicated with some flags. The output then is (k_1, k_1_neg, k_2, k_2_neg)
.