Fix base scalar multiplication (#117)
Pascal Berrang pb.pascal@gmail.com
Thu, 23 Mar 2023 21:53:45 +0000
3 files changed,
3 insertions(+),
2 deletions(-)
M
CHANGELOG.md
→
CHANGELOG.md
@@ -1,6 +1,7 @@
# CHANGELOG ## Pending +- [\#117](https://github.com/arkworks-rs/r1cs-std/pull/117) Fix result of `precomputed_base_scalar_mul_le` to not discard previous value. ### Breaking changes
M
src/groups/curves/short_weierstrass/mod.rs
→
src/groups/curves/short_weierstrass/mod.rs
@@ -559,7 +559,7 @@ let (bits, bases): (Vec<_>, Vec<_>) = scalar_bits_with_bases
.map(|(b, c)| (b.borrow().clone(), *c)) .unzip(); let base = bases[0]; - *self = Self::constant(base).scalar_mul_le(bits.iter())?; + *self += Self::constant(base).scalar_mul_le(bits.iter())?; Ok(()) } }
M
src/groups/mod.rs
→
src/groups/mod.rs
@@ -134,7 +134,7 @@ // If `bit == 1`, set self = self + 2^i * original;
// else, set self = self; result = bit.borrow().select(&self_plus_base, &result)?; } - *self = result; + *self += result; Ok(()) }