File tree Expand file tree Collapse file tree 6 files changed +8
-8
lines changed Expand file tree Collapse file tree 6 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -115,7 +115,7 @@ impl ExtendedPoint {
115115
116116 // Compute x
117117 let xy = x * y;
118- let x_numerator = xy + xy ;
118+ let x_numerator = xy. double ( ) ;
119119 let x_denom = y. square ( ) - ( a * x. square ( ) ) ;
120120 let new_x = x_numerator * x_denom. invert ( ) ;
121121
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ impl ExtensiblePoint {
5252 pub fn double ( & self ) -> ExtensiblePoint {
5353 let A = self . X . square ( ) ;
5454 let B = self . Y . square ( ) ;
55- let C = self . Z . square ( ) + self . Z . square ( ) ;
55+ let C = self . Z . square ( ) . double ( ) ;
5656 let D = -A ;
5757 let E = ( self . X + self . Y ) . square ( ) - A - B ;
5858 let G = D + B ;
Original file line number Diff line number Diff line change @@ -550,7 +550,7 @@ impl CompressedDecaf {
550550 let ( I , ok) = ( v * u1_sqr) . inverse_square_root ( ) ;
551551
552552 let Dx = I * u1;
553- let Dxs = ( s + s ) * Dx ;
553+ let Dxs = s . double ( ) * Dx ;
554554
555555 let mut X = ( Dxs * I ) * v;
556556 let k = Dxs * FieldElement :: DECAF_FACTOR ;
Original file line number Diff line number Diff line change @@ -673,7 +673,7 @@ impl EdwardsPoint {
673673
674674 // Compute x
675675 let xy = x * y;
676- let x_numerator = xy + xy ;
676+ let x_numerator = xy. double ( ) ;
677677 let x_denom = y. square ( ) - ( a * x. square ( ) ) ;
678678 let new_x = x_numerator * x_denom. invert ( ) ;
679679
Original file line number Diff line number Diff line change @@ -317,7 +317,7 @@ impl FieldElement {
317317 }
318318
319319 pub fn double ( & self ) -> Self {
320- Self ( self . 0 . add ( & self . 0 ) )
320+ Self ( self . 0 . double ( ) )
321321 }
322322
323323 /// Computes the inverse square root of a field element
@@ -426,7 +426,7 @@ impl FieldElement {
426426 let b = b - Self :: ONE ;
427427
428428 let c = a. square ( ) ;
429- let a = a + a ;
429+ let a = a. double ( ) ;
430430 let e = c + Self :: ONE ;
431431 let T = a * e;
432432 let X = a * b;
Original file line number Diff line number Diff line change @@ -314,7 +314,7 @@ impl<C: CurveWithScalar> Field for Scalar<C> {
314314 }
315315
316316 fn double ( & self ) -> Self {
317- self + self
317+ self . double ( )
318318 }
319319
320320 fn invert ( & self ) -> CtOption < Self > {
@@ -641,7 +641,7 @@ impl<C: CurveWithScalar> Scalar<C> {
641641
642642 /// Compute `self` + `self` mod ℓ
643643 pub const fn double ( & self ) -> Self {
644- self . addition ( self )
644+ Self :: new ( self . scalar . double_mod ( & ORDER ) )
645645 }
646646
647647 /// Compute `self` - `rhs` mod ℓ
You can’t perform that action at this time.
0 commit comments