File tree Expand file tree Collapse file tree 2 files changed +1
-21
lines changed Expand file tree Collapse file tree 2 files changed +1
-21
lines changed Original file line number Diff line number Diff line change @@ -334,8 +334,7 @@ impl EdwardsPoint {
334
334
/// Generic scalar multiplication to compute s*P
335
335
pub fn scalar_mul ( & self , scalar : & EdwardsScalar ) -> Self {
336
336
// Compute floor(s/4)
337
- let mut scalar_div_four = * scalar;
338
- scalar_div_four. div_by_four ( ) ;
337
+ let scalar_div_four = scalar. halve ( ) . halve ( ) ;
339
338
340
339
// Use isogeny and dual isogeny to compute phi^-1((s/4) * phi(P))
341
340
variable_base ( & self . to_twisted ( ) , & scalar_div_four) . to_untwisted ( )
Original file line number Diff line number Diff line change @@ -658,25 +658,6 @@ impl<C: CurveWithScalar> Scalar<C> {
658
658
self . scalar . is_zero ( )
659
659
}
660
660
661
- /// Divides a scalar by four without reducing mod p
662
- /// This is used in the 2-isogeny when mapping points from Ed448-Goldilocks
663
- /// to Twisted-Goldilocks
664
- pub ( crate ) fn div_by_four ( & mut self ) {
665
- let s_mod_4 = self [ 0 ] & 3 ;
666
-
667
- let s_plus_l = self . scalar + ORDER ;
668
- let s_plus_2l = s_plus_l + ORDER ;
669
- let s_plus_3l = s_plus_2l + ORDER ;
670
-
671
- self . scalar . conditional_assign ( & s_plus_l, s_mod_4. ct_eq ( & 1 ) ) ;
672
- self . scalar
673
- . conditional_assign ( & s_plus_2l, s_mod_4. ct_eq ( & 2 ) ) ;
674
- self . scalar
675
- . conditional_assign ( & s_plus_3l, s_mod_4. ct_eq ( & 3 ) ) ;
676
-
677
- self . scalar >>= 2 ;
678
- }
679
-
680
661
// This method was modified from Curve25519-Dalek codebase. [scalar.rs]
681
662
// We start with 14 u32s and convert them to 56 u8s.
682
663
// We then use the code copied from Dalek to convert the 56 u8s to radix-16 and re-center the coefficients to be between [-16,16)
You can’t perform that action at this time.
0 commit comments