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 {
115
115
116
116
// Compute x
117
117
let xy = x * y;
118
- let x_numerator = xy + xy ;
118
+ let x_numerator = xy. double ( ) ;
119
119
let x_denom = y. square ( ) - ( a * x. square ( ) ) ;
120
120
let new_x = x_numerator * x_denom. invert ( ) ;
121
121
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ impl ExtensiblePoint {
52
52
pub fn double ( & self ) -> ExtensiblePoint {
53
53
let A = self . X . square ( ) ;
54
54
let B = self . Y . square ( ) ;
55
- let C = self . Z . square ( ) + self . Z . square ( ) ;
55
+ let C = self . Z . square ( ) . double ( ) ;
56
56
let D = -A ;
57
57
let E = ( self . X + self . Y ) . square ( ) - A - B ;
58
58
let G = D + B ;
Original file line number Diff line number Diff line change @@ -550,7 +550,7 @@ impl CompressedDecaf {
550
550
let ( I , ok) = ( v * u1_sqr) . inverse_square_root ( ) ;
551
551
552
552
let Dx = I * u1;
553
- let Dxs = ( s + s ) * Dx ;
553
+ let Dxs = s . double ( ) * Dx ;
554
554
555
555
let mut X = ( Dxs * I ) * v;
556
556
let k = Dxs * FieldElement :: DECAF_FACTOR ;
Original file line number Diff line number Diff line change @@ -673,7 +673,7 @@ impl EdwardsPoint {
673
673
674
674
// Compute x
675
675
let xy = x * y;
676
- let x_numerator = xy + xy ;
676
+ let x_numerator = xy. double ( ) ;
677
677
let x_denom = y. square ( ) - ( a * x. square ( ) ) ;
678
678
let new_x = x_numerator * x_denom. invert ( ) ;
679
679
Original file line number Diff line number Diff line change @@ -317,7 +317,7 @@ impl FieldElement {
317
317
}
318
318
319
319
pub fn double ( & self ) -> Self {
320
- Self ( self . 0 . add ( & self . 0 ) )
320
+ Self ( self . 0 . double ( ) )
321
321
}
322
322
323
323
/// Computes the inverse square root of a field element
@@ -426,7 +426,7 @@ impl FieldElement {
426
426
let b = b - Self :: ONE ;
427
427
428
428
let c = a. square ( ) ;
429
- let a = a + a ;
429
+ let a = a. double ( ) ;
430
430
let e = c + Self :: ONE ;
431
431
let T = a * e;
432
432
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> {
314
314
}
315
315
316
316
fn double ( & self ) -> Self {
317
- self + self
317
+ self . double ( )
318
318
}
319
319
320
320
fn invert ( & self ) -> CtOption < Self > {
@@ -641,7 +641,7 @@ impl<C: CurveWithScalar> Scalar<C> {
641
641
642
642
/// Compute `self` + `self` mod ℓ
643
643
pub const fn double ( & self ) -> Self {
644
- self . addition ( self )
644
+ Self :: new ( self . scalar . double_mod ( & ORDER ) )
645
645
}
646
646
647
647
/// Compute `self` - `rhs` mod ℓ
You can’t perform that action at this time.
0 commit comments