Skip to content
This repository has been archived by the owner on Nov 9, 2023. It is now read-only.

#ITEM 2 - Get testing values for Point Operations. #31

Closed
CPerezz opened this issue Jun 26, 2019 · 3 comments
Closed

#ITEM 2 - Get testing values for Point Operations. #31

CPerezz opened this issue Jun 26, 2019 · 3 comments
Assignees
Labels
help wanted Extra attention is needed testing This feature requires to be tested.

Comments

@CPerezz
Copy link
Contributor

CPerezz commented Jun 26, 2019

We need to get values to test the implementations done for:

  • Point Addition.
  • Point Subtraction.
  • Point Doubling.
  • Point Compression.
  • TwEdws -> Montgomery Conversion.

We should get the values and the expected results with sage in order to be able to test every operation.

@LukePearson1
Copy link
Contributor

For the point operations, we ill use these computed values:

(4, 2sqrt[1386409]) & (18, 2sqrt[1386409]). Using indentity points for T & Z in extended co-oridnates, (X : Y : Z : T)

Point addition using addition formulae to derive point:

sage: x1 = 4 \\ sage: x2 = 18 \\ sage: y1 = 2*sqrt(1386409)\\ sage: y2 = 2*sqrt(1386409)\\ sage: x3 = (x1*y2)+(y1*x2)/1+d*x1*x2*y1*y2\\ sage: x3\\ 44*sqrt(1386409) - 17298857295504/43325\\ sage: a = -1\\ sage: y3 = (y1*y2 - a*x1*x2)/1-d*x1*x2*y1*y2\\ sage: y3\\ 17539125094604/43325

To find point: (44*sqrt(1386409) - 17298857295504/43325, 17539125094604/43325)

@CPerezz
Copy link
Contributor Author

CPerezz commented Jul 2, 2019

After trying the values provided earlier, we are not passing the Point Addition test. So we need to check if we are obtaining the points correctly. Since the algorithm is pretty straightforward.

CPerezz added a commit to CPerezz/Corretto that referenced this issue Jul 3, 2019
This closes dusk-network#31 since the point values obtained
were proven correct.

- Refactored Point addition and subtraction functions.
- Tested Point Addition successfully.
- Tested Point doubling with double addition successfully.
@CPerezz
Copy link
Contributor Author

CPerezz commented Jul 3, 2019

By using the Legendre Symbol and the Tonelli-Shanks algorithm. We've been able to get valid y coordinates for Twisted Edwards Points on Cartesian Coordinates.

Once there, the Points have been moved to the Twisted Edwards Extended Coordinates format, and we got:

pub static P1: EdwardsPoint = EdwardsPoint {
        X: FieldElement([23, 0, 0, 0, 0]),
        Y: FieldElement([1664892896009688, 132583819244870, 812547420185263, 637811013879057, 13284180325998]),
        Z: FieldElement([1, 0, 0, 0, 0]),
        T: FieldElement([4351986304670635, 4020128726404030, 674192131526433, 1158854437106827, 6468984742885])
    };

    pub static P2: EdwardsPoint = EdwardsPoint {
        X: FieldElement([68, 0, 0, 0, 0]),
        Y: FieldElement([1799957170131195, 4493955741554471, 4409493758224495, 3389415867291423, 16342693473584]),
        Z: FieldElement([1, 0, 0, 0, 0]),
        T: FieldElement([3505259403500377, 292342788271022, 2608000066641474, 796697979921534, 2995435405555])
    };

These points come from random x's that had a y existing over the field GF(P).

@CPerezz CPerezz closed this as completed Jul 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help wanted Extra attention is needed testing This feature requires to be tested.
Projects
None yet
Development

No branches or pull requests

2 participants