On the elliptic curves, there is no divide function, and I need divide coordinates - X/Y, o I need not divide but make (X minus or multiply to "modified" Y). How to modify Y?
-
Using conventional notation, you can't multiply or divide points on an elliptic curve. Can you explain more on what you want to do? – Aman Grewal Jul 28 '20 at 21:24
-
I Thant get Z = X/Y , I need inversion of Y and add after this inversed Y – Donald Jul 28 '20 at 21:26
-
Yes Kalalaka, and what formula for inverse this Y element ? And what I need to do after with Y Add this inversed Y or subtract Y from X for get X/Y ? – Donald Jul 28 '20 at 21:29
-
You are professionals I hope you understand what I talk about. – Donald Jul 28 '20 at 21:36
-
You can use the Extended_GCD to find the inverse. Your question is not clear. You should write something like this. Given a point P=(x,y) in affine coordinates how can I found $Q=(x/z,y/t)$. I'm pretty sure there were similar questions around here that people don't understand /Y infinite fileds. It is just $Y^{-1}$. – kelalaka Jul 28 '20 at 21:36
-
It is not about us, it is about the quality of the question so that it can be answered. Otherwise, it will be flagged as unclear for the close. – kelalaka Jul 28 '20 at 21:38
-
I'm need exact Q=(x/y) on elliptic cure. x,y- this is a coordinate of point, and Q is a number, – Donald Jul 28 '20 at 21:39
-
Then you are still missing the point definition. How you define a point with only one element. In the affine coordinate, you need two, in Homogeneous Coordinates, you need three. – kelalaka Jul 28 '20 at 21:42
-
Why do you need $X/Y$? I can't think off the top any place where that is used. – poncho Jul 28 '20 at 21:43
-
I need X/Y for future calc of private key. and privkey only ONE element. – Donald Jul 28 '20 at 21:44
-
But the private key is just a random element $k$ and the public key $[k]G$, where $G$ is the generator point and $[]$ mean scalar multiplication. – kelalaka Jul 28 '20 at 21:49
-
Yes respected Kalalaka, I need a Y−1 – Donald Jul 28 '20 at 22:00
-
Then use extended GCD as I said before. See Finite field arithmetic Multiplicative inverse – kelalaka Jul 28 '20 at 22:03
-
Yes kalalaka I need Extended_GCD. Why you ask me , because of if base point =(1,1) then privkey = PubkeyX/PubkeyY. ))) And I not need exact walue, for me well, jast approximately, know a way to get the exact value after.. – Donald Jul 28 '20 at 23:01
-
You are missing the scalar multiplication with ordinary multiplication. You can see here or some other places. The base point is defined by the standards. The identity element is the point at infinity – kelalaka Jul 28 '20 at 23:19
-
You need to see What is the point at infinity on secp256k1 and how to calculate it? and Koblitz curve secp256k1 – kelalaka Jul 28 '20 at 23:27
-
"if base point =(1,1) then privkey = PubkeyX/PubkeyY. )))" - no; if there were a way to recover the private key based on the public key, ECC would be broken, as we specifically assume that no one can do that... – poncho Jul 29 '20 at 13:44
1 Answers
An elliptic curve as used in cryptography is a finite group, constructed on top a finite field. A pair of elements of the field that obey the curve equation form the Cartesian coordinates of a point of the elliptic curve group (and vice versa for all points of the elliptic curve group, except the neutral / point at infinity, often noted $\infty$).
In the field we can add; subtract; multiply; and divide, except by 0. The result is an element of the field.
In the elliptic curve group we can add and subtract. The result is an element of the elliptic curve group. One such addition involves several operations in the field (with the exception of addition of the neutral).
There is no multiplication in the elliptic curve group: we can't meaningfully multiply two points of an elliptic curve group. We can however define multiplication of an integer $k$ and a point $U$ of an elliptic curve group, by using repeated addition: $$k\times U\,\underset{\text{def}}=\;\begin{cases}\infty&\text{if }k=0\\((k-1)\times U)+U&\text{if }k>0\\(-k)\times(-U)&\text{if }k<0\end{cases}$$
It follows $1\times U=U$, and $2\times U=U+U$.
On the elliptic curves, there is no divide function.
That's an oversimplification. We can meaningfully define division of two points of an elliptic curve. $U/V$ can be the lowest non-negative integer $k$ such that $U=k\times V$, when there exists such an integer. For many elliptic curves of cryptographic interest, that operation is defined except when $V=\infty$; but is not efficiently computable for random $U$ or $V$ (that's the very basis of the security of cryptography on that elliptic curve).
How to divide 2 coordinates on elliptic curve?
That's just a division in the field, independent of an elliptic curve. How to perform the operation depends on the field.
A common field is $\Bbb F_p$, that is arithmetic modulo a prime $p$. In this field, we can compute $x/y$ (for $y\ne0$):
- as $x\cdot\left(y^{p-2}\right)$, computed modulo $p$. In Python, that's
x*pow(y,p-2,p)%p
. - or, more efficiently, as $x\cdot a$, computed modulo $p$, where $a$ is the modular inverse of $y$ computed using the extended Euclidean algorithm. The integer $a$ (and the integer $b$, that we do not need) is found by solving for unknowns $a$, $b$ and givens $y$, $p$ the Bézout identity $a\cdot y+b\cdot p=1$. In Python starting with version 3.8, that's
x*pow(y,-1,p)%p
.

- 140,762
- 12
- 307
- 587