Score:2

Elliptic curve Jacobian coordinates example

mf flag

I am working on Matlab Jacobian coordinates, I want a jacobian coordinates example with numbers include doubling and additions based on k value to test the code if works properly? I tried to search in google to find any example, but I didn't find.

Can anyone refer to me a clear example includes numbers with answers to test my code

Thanks for all

Score:3
de flag

I have some test vectors included in the source code for my secp256k1 implementation called ekliptic. This sounds like it might be similar to what you're after. However... you should probably convert Jacobian coordinates back to affine coordinates before comparing the results of Jacobian point addition/doubling operations. Here's why.


For any affine point $(x_a,y_a)$, there is an absurdly large number of possible Jacobian coordinate triplets $(x_j,y_j,z)$ which satisfy the requirements of Jacobian coordinates:

$$x_a = \frac{x_j}{z^2}$$

$$y_a = \frac{y_j}{z^3}$$

$z$ is basically a scaling factor we use to defer and accumulate division operations.

As a more concrete example, one could represent the affine point $(7,10)$ as the Jacobian $(x,y,z)$ points:

  • $(7,10,1)$
  • $(28,80,2)$
  • $(63,270,3)$
  • $(112,640,4)$
  • etc etc.

As a result, I've found that different addition/doubling formulas will give me different Jacobian coordinates. For example, in my ekliptic library, I used the add-1998-cmo-2 formula for addition. But if I used a different addition formula to add the same two Jacobian points, I might get a different $(x_j,y_j,z)$ output. Indeed when i tried to scrape and reuse some test vectors from the btcec project, i ran into exactly this issue, because they chose different formulas than I chose.

As long as two sets of Jacobian coordinates simplify to the same affine point $(x_a,y_a)$, they are still fundamentally equivalent, but this means that test vectors from one project may not be reusable for yours, without doing some conversions first.

Usually converting back to affine is simpler.

Mohammad Khaled avatar
mf flag
what is the a, b and p values you are using in your example?
JoeJafarTheJenie avatar
de flag
I'm using the secp256k1 curve which is $y^2 = x^3 + 7$. You can look up those parameters online. Here's where they're defined in my library: https://github.com/kklash/ekliptic/blob/main/constants.go
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.