@@ -80,11 +80,11 @@ impl ExtendedPoint {
80
80
/// Returns an extensible point
81
81
/// (3.1) https://iacr.org/archive/asiacrypt2008/53500329/53500329.pdf
82
82
pub fn add_extended ( & self , other : & ExtendedPoint ) -> ExtensiblePoint {
83
- let A = self . X * other. X ;
84
- let B = self . Y * other. Y ;
85
- let C = self . T * other. T * FieldElement :: TWISTED_D ;
86
- let D = self . Z * other. Z ;
87
- let E = ( self . X + self . Y ) * ( other . X + other . Y ) - A - B ;
83
+ let A = ( self . Y - self . X ) * ( other. Y - other . X ) ;
84
+ let B = ( self . Y + self . X ) * ( other. Y + other . X ) ;
85
+ let C = FieldElement :: TWO_TIMES_TWISTED_D * self . T * other. T ;
86
+ let D = ( self . Z * other. Z ) . double ( ) ;
87
+ let E = B - A ;
88
88
let F = D - C ;
89
89
let G = D + C ;
90
90
let H = B + A ;
@@ -97,27 +97,6 @@ impl ExtendedPoint {
97
97
}
98
98
}
99
99
100
- /// Subtracts an extensible point from an extended point
101
- /// Returns an extensible point
102
- /// This is a direct modification of the addition formula to the negation of `other`
103
- pub fn sub_extended ( & self , other : & ExtendedPoint ) -> ExtensiblePoint {
104
- let A = self . X * other. X ;
105
- let B = self . Y * other. Y ;
106
- let C = self . T * other. T * FieldElement :: TWISTED_D ;
107
- let D = self . Z * other. Z ;
108
- let E = ( self . X + self . Y ) * ( other. Y - other. X ) + A - B ;
109
- let F = D + C ;
110
- let G = D - C ;
111
- let H = B - A ;
112
- ExtensiblePoint {
113
- X : E * F ,
114
- Y : G * H ,
115
- T1 : E ,
116
- T2 : H ,
117
- Z : F * G ,
118
- }
119
- }
120
-
121
100
/// Adds an extensible point to an AffineNiels point
122
101
/// Returns an Extensible point
123
102
pub fn add_affine_niels ( & self , other : AffineNielsPoint ) -> ExtensiblePoint {
@@ -297,19 +276,6 @@ mod tests {
297
276
assert ! ( c == c_1) ;
298
277
}
299
278
300
- #[ test]
301
- fn test_point_sub ( ) {
302
- let a = TWISTED_EDWARDS_BASE_POINT ;
303
- let b = a. to_extensible ( ) . double ( ) . to_extended ( ) ;
304
-
305
- // A - B = C
306
- let c_1 = a. sub_extended ( & b) . to_extended ( ) ;
307
-
308
- // -B + A = C
309
- let c_2 = b. negate ( ) . add_extended ( & a) . to_extended ( ) ;
310
- assert ! ( c_1 == c_2) ;
311
- }
312
-
313
279
#[ test]
314
280
fn test_negate ( ) {
315
281
let a = TWISTED_EDWARDS_BASE_POINT ;
0 commit comments