| | | 1 | | using System; |
| | | 2 | | |
| | | 3 | | namespace Renci.SshNet.Security.Chaos.NaCl.Internal.Ed25519Ref10 |
| | | 4 | | { |
| | | 5 | | /* |
| | | 6 | | ge means group element. |
| | | 7 | | |
| | | 8 | | Here the group is the set of pairs (x,y) of field elements (see fe.h) |
| | | 9 | | satisfying -x^2 + y^2 = 1 + d x^2y^2 |
| | | 10 | | where d = -121665/121666. |
| | | 11 | | |
| | | 12 | | Representations: |
| | | 13 | | ge_p2 (projective): (X:Y:Z) satisfying x=X/Z, y=Y/Z |
| | | 14 | | ge_p3 (extended): (X:Y:Z:T) satisfying x=X/Z, y=Y/Z, XY=ZT |
| | | 15 | | ge_p1p1 (completed): ((X:Z),(Y:T)) satisfying x=X/Z, y=Y/T |
| | | 16 | | ge_precomp (Duif): (y+x,y-x,2dxy) |
| | | 17 | | */ |
| | | 18 | | |
| | | 19 | | internal struct GroupElementP2 |
| | | 20 | | { |
| | | 21 | | public FieldElement X; |
| | | 22 | | public FieldElement Y; |
| | | 23 | | public FieldElement Z; |
| | | 24 | | } ; |
| | | 25 | | |
| | | 26 | | internal struct GroupElementP3 |
| | | 27 | | { |
| | | 28 | | public FieldElement X; |
| | | 29 | | public FieldElement Y; |
| | | 30 | | public FieldElement Z; |
| | | 31 | | public FieldElement T; |
| | | 32 | | } ; |
| | | 33 | | |
| | | 34 | | internal struct GroupElementP1P1 |
| | | 35 | | { |
| | | 36 | | public FieldElement X; |
| | | 37 | | public FieldElement Y; |
| | | 38 | | public FieldElement Z; |
| | | 39 | | public FieldElement T; |
| | | 40 | | } ; |
| | | 41 | | |
| | | 42 | | internal struct GroupElementPreComp |
| | | 43 | | { |
| | | 44 | | public FieldElement yplusx; |
| | | 45 | | public FieldElement yminusx; |
| | | 46 | | public FieldElement xy2d; |
| | | 47 | | |
| | | 48 | | public GroupElementPreComp(FieldElement yplusx, FieldElement yminusx, FieldElement xy2d) |
| | 1056 | 49 | | { |
| | 1056 | 50 | | this.yplusx = yplusx; |
| | 1056 | 51 | | this.yminusx = yminusx; |
| | 1056 | 52 | | this.xy2d = xy2d; |
| | 1056 | 53 | | } |
| | | 54 | | } ; |
| | | 55 | | |
| | | 56 | | internal struct GroupElementCached |
| | | 57 | | { |
| | | 58 | | public FieldElement YplusX; |
| | | 59 | | public FieldElement YminusX; |
| | | 60 | | public FieldElement Z; |
| | | 61 | | public FieldElement T2d; |
| | | 62 | | } ; |
| | | 63 | | } |