title | tags | ||||||
---|---|---|---|---|---|---|---|
37. Miller Algorithm |
|
In this lesson, we will introduce the Miller Algorithm, which allows for efficient computation of pairings on elliptic curves.
Let's start by reviewing the Weil pairing, which maps two points
The specific form of the Weil pairing is given by:
where the functions
The Miller Algorithm provides an efficient way to compute the function
- Initialize
$T = P$ and$f = 1$ . - Loop from
$i = t - 1$ to 0:-
$f = f^2 \cdot h_{T,T}$ . -
$T = 2T$ . - If
$\varepsilon_i = 1$ :-
$f = f \cdot h_{T,P}$ . -
$T = T + P$ .
-
-
- End the loop.
- Return the value of
$f$ .
The divisor of the resulting function
When
Let's define a line
The rational function
Similarly, the rational function
By taking the quotient of these two rational functions, we obtain
In particular, when the slope of the line
Next, we expand
where
Through a simple (not really) induction, we can prove that the output
Let's consider a slightly more complex example of the Weil pairing using the Sage software. Sage (also known as SageMath) is an open-source mathematics software system designed to provide a powerful and comprehensive environment for solving various mathematical problems and conducting mathematical research. Its syntax is similar to Python, and you can run Sage programs in your browser using SageMathCell.
We will work with an elliptic curve defined over
It satisfies
The code for this example is as follows:
p = 631
a = 30
b = 34
E = EllipticCurve(GF(p), [a, b])
print(E)
print("Number of elements on the elliptic curve: ", E.cardinality())
# Get points in the 5-torsion group
INF = E[0]
L_E_5 = INF.division_points(5) # [11]P == INF
E_5 = Set(L_E_5) # $5$-torsion
print("5-torsion points: ", E_5)
print("Number of elements in the 5-torsion group: ", E_5.cardinality())
P = E([36,60])
Q = E([121,387])
weil_P_Q = P.weil_pairing(Q, 5)
print("Weil pairing of points", P, "and", Q, "in the 5-torsion group is", weil_P_Q)
# Output
# Elliptic Curve defined by y^2 = x^3 + 30*x + 34 over Finite Field of size 631
# Number of elements on the elliptic curve: 650
# 5-torsion points: {(121 : 244 : 1), (121 : 387 : 1), (420 : 48 : 1), (0 : 1 : 0), (531 : 613 : 1), (36 : 60 : 1), (586 : 584 : 1), (428 : 25 : 1), (586 : 47 : 1), (339 : 132 : 1), (289 : 362 : 1), (575 : 7 : 1), (511 : 23 : 1), (511 : 608 : 1), (617 : 626 : 1), (575 : 624 : 1), (595 : 221 : 1), (617 : 5 : 1), (595 : 410 : 1), (36 : 571 : 1), (531 : 18 : 1), (339 : 499 : 1), (289 : 269 : 1), (428 : 606 : 1), (420 : 583 : 1)}
# Number of elements in the 5-torsion group: 25
# Weil pairing of points (36 : 60 : 1) and (121 : 387 : 1) in the 5-torsion group is 242
Next, we compute the pairing between
Since the Weil pairing satisfies bilinearity, we should have
Therefore, using the Weil pairing, we can verify that
The code for this verification is as follows:
R = 3 * P
S = 4 * Q
weil_R_S = R.weil_pairing(S, 5)
print("Weil pairing of points", R, "and", S, "in the 5-torsion group is", weil_R_S)
print("Since R = 3P and S = 4Q, we have weil_P_Q ^ 12 = ", weil_P_Q^12 , "which is equal to weil_R_S")
# Weil pairing of points (617 : 5 : 1) and (121 : 244 : 1) in the 5-torsion group is 512
# Since R = 3P and S = 4Q, we have weil_P_Q ^ 12 = 512 which is equal to weil_R_S
In this lesson, we have introduced the Miller Algorithm, which enables efficient computation of pairings on elliptic curves. We have also provided an example of the Weil pairing using the Sage software.