|
|
|
|
|
by max_likelihood
1462 days ago
|
|
Thank you so much for creating this! Under the Curve61 point addition example, I was trying to follow the formula for adding two points: P:(x1, y1) + Q(x2, y2) = R(x3=l^2-x1-x2, y3=l(x1-x3)-y1) where l=(y2-y1)/(x2-x1). I tried to use the example P:(5, 7) + 23P:(2, 24) = (226/9, 2888/7) != 24P:(59, 55) and was wondering where I've gone wrong? Appreciate your response! |
|
https://gist.github.com/syncsynchalt/ed02e39ad7adc8580b1086f...
Looking at your comment the disconnect seems to be at the division step: when performing a division such as 226/9, look up or calculate the multiplicative inverse for 9 (you can use the table at https://curves.ulfheim.net/inverse61.html), which is 34, and multiply by that instead. This is explained at https://curves.ulfheim.net/#division-multiplicative-inverse
In F61, 226/9 = 226*34 = 7684 % 61 = 59.
In F61, 2888/27 = 2888*52 = 150176 % 61 = 55.
(you can also proactively reduce those numerators and calculate with some smaller numbers):
(226%61)/9 => 43/9
(2888%61)/27 => 21/27