Skip to content

Commit

Permalink
Scalar exponentiation
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronFeickert committed Mar 25, 2024
1 parent 3b46859 commit 4bf0d80
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ description = "A smaller faster implementation of Bulletproofs"
[dependencies]
blake2 = { version = "0.10", default-features = false }
byteorder = { version = "1", default-features = false }
curve25519-dalek = { version = "4", default-features = false, features = ["alloc", "rand_core", "serde", "zeroize"] }
curve25519-dalek = { version = "4", default-features = false, features = ["alloc", "group", "rand_core", "serde", "zeroize"] }
digest = { version = "0.10", default-features = false, features = ["alloc"] }
ff = "0.13.0"
itertools = { version = "0.12", default-features = false, features = ["use_alloc"] }
merlin = { version = "3", default-features = false }
once_cell = { version = "1", default-features = false, features = ["alloc", "critical-section"] }
Expand Down
5 changes: 3 additions & 2 deletions src/range_proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use curve25519_dalek::{
scalar::Scalar,
traits::{Identity, IsIdentity, MultiscalarMul, VartimePrecomputedMultiscalarMul},
};
use ff::Field;
use itertools::{izip, Itertools};
use merlin::Transcript;
use rand_core::CryptoRngCore;
Expand Down Expand Up @@ -774,7 +775,7 @@ where

// Compute 2**n-1 for later use
let two = Scalar::from(2u8);
let two_n_minus_one = (0..bit_length.ilog2()).fold(two, |acc, _| acc * acc) - Scalar::ONE;
let two_n_minus_one = two.pow_vartime([bit_length as u64]) - Scalar::ONE;

// Weighted coefficients for common generators
let mut g_base_scalars = vec![Scalar::ZERO; extension_degree];
Expand Down Expand Up @@ -901,7 +902,7 @@ where
let e_square = e * e;
let challenges_sq: Vec<Scalar> = challenges.iter().map(|c| c * c).collect();
let challenges_sq_inv: Vec<Scalar> = challenges_inv.iter().map(|c| c * c).collect();
let y_nm = (0..rounds).fold(y, |y_nm, _| y_nm * y_nm);
let y_nm = y.pow_vartime([full_length as u64]);
let y_nm_1 = y_nm * y;

// Compute the sum of powers of the challenge as a partial sum of a geometric series
Expand Down

0 comments on commit 4bf0d80

Please sign in to comment.