diff --git a/starknet-curve/src/ec_point.rs b/starknet-curve/src/ec_point.rs index 1a7b0f71..6500480e 100644 --- a/starknet-curve/src/ec_point.rs +++ b/starknet-curve/src/ec_point.rs @@ -138,7 +138,7 @@ impl ops::Mul<&[bool]> for &AffinePoint { #[allow(clippy::suspicious_arithmetic_impl)] fn mul(self, rhs: &[bool]) -> Self::Output { let mut product = AffinePoint::identity(); - for b in rhs.iter().rev() { + for b in rhs.iter().rev().skip_while(|b| !*b) { product.double_assign(); if *b { product += self; @@ -284,7 +284,7 @@ impl ops::Mul<&[bool]> for &ProjectivePoint { #[allow(clippy::suspicious_arithmetic_impl)] fn mul(self, rhs: &[bool]) -> Self::Output { let mut product = ProjectivePoint::identity(); - for b in rhs.iter().rev() { + for b in rhs.iter().rev().skip_while(|b| !*b) { product.double_assign(); if *b { product += self;