gdanezis / PET-Exercises

Exercises in Privacy Enhancing Technologies (UCL Information Security MSc; Course COMPGA17)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Redundant arguments in point_add(a, b, p, x0, y0, x1, y1)?

ralienpp opened this issue · comments

Hello, I would like to ask about the reasoning for having

  1. a and b in the function's prototype, when the formula for calculating the sum of two points does not require them (it only needs the coordinates of both points and p). Is this to perform a sanity check and verify whether the points are on the curve before attempting to add them?

  2. p is required, according to the formula in the function's docstring, and hence the function expects this parameter as well. However, if I look into various sources that explain how this works (e.g. https://en.wikipedia.org/wiki/Elliptic_curve_point_multiplication#Point_addition) then there is no mod p component there. Why is it required here?

This is the function I refer to: https://github.com/gdanezis/PET-Exercises/blob/master/Lab01Basics/Lab01Code.py#L91