Curves

January 25, 2025 · View on GitHub

Everything in ronkathon (and much of modern day cryptography) works with elliptic curves EE as primitives. Simply put, an elliptic curve is a curve defined by the equation y2=x3+ax+by^2 = x^3 + ax + b where aa and bb are constants that define the curve. When working over a finite field so that x,ya,bFqx, y a, b \in \mathbb{F}_q, we put E(Fq)E(\mathbb{F}_q) to denote the set of points on the curve over the field Fq\mathbb{F}_q. It turns out that the set of points E(Fq)E(\mathbb{F}_q) forms a group under a certain operation called point addition. This group, in at least certain cases, is discrete logarithm hard, which is the basis for much of modern day cryptography.

Curve Group and Pluto Curve

For the sake of ronkathon, we use a specific curve which we affectionately call the "Pluto Curve." Our equation is: y2=x3+3y^2 = x^3 + 3 and we work with the field FpF_p and Fp2F_{p^2} where p=101p = 101. Predominantly, we use the extension Fp2F_{p^2} since we need this for the Tate pairing operation. We refer to F101F_{101} as the PlutoBaseField and F1012F_{101^2} as the PlutoBaseFieldExtension within ronkathon. From which, we also use the terminology of PlutoCurve to refer to E(F101)E(F_{101}) and PlutoExtendedCurve to refer to E(F1012)E(F_{101^2}).

We also define a CurveGroup, an extension of FiniteGroup trait representing the group law of the curve.

Type B curve and type 1 pairing

Investigating our curve and choice of field, we find that the curve is Type B since:

  • It is of the form y2=x3+by^2 = x^3 + b;
  • p=1012mod3p = 101 \equiv 2 \mod 3; It follows that E(F101)E(\mathbb{F}_{101}) is supersingular which implies that the PlutoCurve has order (number of points) n=101+1=102n = 101 + 1 = 102 and PlutoExtendedCurve has order n2=n^2 = 102^{2}=10404 = 10404. Finally, the embedding degree of the curve is k=2k=2.
  • This curve has a 17-torsion subgroup calculated as largest prime factor of order of curve 102 = 17.2.3.

Since, the curve is supersingular, this allows us to define the type-1 Tate pairing e ⁣:G1×G2Fp2e \colon G_{1} \times G_{2} \to F_{p^2}^{*} in a convenient manner, where both G1,G2G1G_{1},G_{2}\in\mathcal{G}_{1}, i.e. the base field subgroup of r-torsion subgroup.

In particular, we can pick G1\mathbb{G}_{1} to be the rr-torsion subgroup of PlutoCurve where r=17r = 17 is the scalar field of the curve. Note that r=17r=17 is valid since $17 \nmid 101-1 and \17 \mid 1012101^{2} -1$ (Balasubramanian-Koblitz theorem).

In this case, we pick G=Z17G = Z_{17} and define our pairing as: e(P,Q)=f(P,Ψ(Q))(p21)/re(P, Q) = f(P, \Psi(Q))^{(p^2-1)/r} where ff is the Tate pairing and Ψ\Psi is the map Ψ(x,y)=(ζx,y)\Psi(x,y) = (\zeta x, y) where ζ\zeta is a primitive cube root of unity. This is due to the fact that Ψ\Psi is the distortion map that maps a factor of E(F1012)[17]Z17×Z17E(F_{101^2})[17] \cong Z_{17} \times Z_{17} (which is the $17$-torsion group) to the other.

Pairing and Miller's algorithm

Let's dive a little bit deeper into divisors, and miller's algorithm.

Divisors essentially are just a way to represent zeroes and poles of a rational function. We are interested in divisors of functions evaluated on Elliptic curves, i.e. divf=PEnP(P)\text{div}f=\sum_{P\in E} n_P(P).

For example: let's take a function f=x38f=x^3-8 with xCx\in\mathbb{C}, it's divisor is written as (f)(f) and it has a zero of order 3 at x=2x=2 and a pole of order 3 at x=x=\infty, thus, (f)=3(2)3()(f) = 3(2) - 3(\infty).

For an elliptic curve, a line usually intersects the curve at 3 points P,Q,R=(P+Q)P,Q,R=(P+Q), then the divisor is written as (l)=(P)+(Q)+(R)3(O)(l)=(P)+(Q)+(R)-3(O). Note all of these divisors are degree-zero divisors as sum of their multiplicities is 0. There's another concept called support of divisor = supp(D)={PE:nP0}\text{supp}(D)=\{P\in E:n_P \neq 0\}.

Now, we have most of the things we need to represent tate pairing:

e(P,Q)=fP(DQ)e(P,Q)=f_P(D_Q)

where fPf_P is a rational function with (fP)=r(P)r(O)(f_P) = r(P) - r(O) and DQD_Q is the divisor equivalent to (DQ)(Q)(O)(D_Q)\sim (Q)-(O).

Miller's algorithm

fr,Pf_{r,P} can be calculated as fr1,Pl[r1]P,PvrPf_{r-1,P}\cdot\frac{l_{[r-1]P,P}}{v_{rP}} where l[m]P,Pl_{[m]P,P} is the line from [m]P[m]P and PP, and v[m]Pv[m]P is the vertical line going from m[P],[m]Pm[P], -[m]P. Both of these lines are used in chord-and-tangent rule in Elliptic curve group addition law.

Usual naive way is impractical on where r2160r\sim 2^{160}, and thus, for practical pairings, Miller's algorithm is used that has O(logr)O(\log r) time complexity, and uses an algorithm similar to double-and-add algorithm.

Helpful Definitions

Here are a few related definitions that might be helpful to understand the curve and the pairing.

roots of unity

the rthrth root of unity in FpF_p is some number hh such that hr1h^r \equiv 1, For example in our field scaler field F101F_{101} the $4throotsofunityareroots of unity are{1,10,91,100}$.

rr-torsion

rr-torsion points are points PE(K)rP=OP \in E(K) | rP = O for some point PP so that PP has order rr or is a factor of rr. The set of r-torsion points in E(K)E(K) is denoted E(K)[r]E(K)[r]. If Kˉ\bar{K} is the algebraic closure of KK then the number of r-torsion points in E(K)E(K) is the number of points in E(Kˉ)[r]=r2E(\bar{K})[r] = r^2.

  • Security note: If rr and qq are not co-prime then the discrete log is solvable in linear time with something called an anomaly attack.

Frobenius endomorphism

Curve endomorphisms are maps that take points in one a curve subgroup and map them to themselves. An example is point addition and point doubling. The Frobenius endomorphism denoted Φ\Phi takes points in PE(Fq)P \in E(F_q) and maps them Φ(P)=(Xq,Yq)\Phi(P) = (X^q, Y^q) .

For higher powers of the map you write Φk\Phi^k .

Trace Map

This then allows us to define the trace map which takes points in E(Fqk)E(F_{q^k}) and maps them to E(Fq)E(F_q)

tr(P)=P+Φ(P)+...+Φk1(P)tr(P) = P + \Phi(P ) + ... + \Phi^{k−1}(P )

Since k=2k=2 in our parameters we get tr(P)=P+Φ(P)tr(P) = P + \Phi(P).

Trace Zero Subgroup: The set of points of trace zero G={PtrP=O}G = \{P | tr P = O\} is a cyclic group of order rr, and every PGP \in G satisfies Φ(P)=qP\Phi(P ) = qP .

Quadratic Non Residue

A Quadratic Non-residue is a number that, cannot be expressed as a square of any other number. In other words, for a given modulus nn, a number bb is a quadratic non-residue if there is no number a satisfying the congruence a2ba^2 ≡ b (mod n).

An example of quadratic non-residues would be the number 2 in modulo 3, 4, or 5. In these cases, there is no integer that we can square and then divide by the given modulus to get a remainder of 2.

References

Note that most of these are gross over-simplification of actual concepts and we advise you to refer to these references for further clarifications.