Skip to content

Commit

Permalink
Simplify types
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronFeickert committed Feb 17, 2022
1 parent 3762f8e commit 4003efb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/liblelantus/sigmaextended_prover.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ void SigmaExtendedProver::sigma_commit(
std::vector<std::vector<Scalar>> partial_p_s;

// Pre-calculate product parts and calculate p_s(x) at the same time, put the latter into p_i_sum
for (std::size_t j = m_; j > 0; j--) {
for (std::ptrdiff_t j = m_ - 1; j >= 0; j--) {
partial_p_s.push_back(p_i_sum);
LelantusPrimitives::new_factor(sigma[(j - 1) * n_ + I[j - 1]], a[(j - 1) * n_ + I[j - 1]], p_i_sum);
LelantusPrimitives::new_factor(sigma[j*n_ + I[j]], a[j*n_ + I[j]], p_i_sum);
}

for (std::size_t j = 0; j < m_; j++) {
Expand Down
14 changes: 7 additions & 7 deletions src/liblelantus/sigmaextended_verifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ bool SigmaExtendedVerifier::singleverify(
const std::vector<GroupElement>& commits,
const Scalar& x,
const Scalar& serial,
const size_t setSize,
const std::size_t setSize,
const SigmaExtendedProof& proof) const {
std::vector<Scalar> challenges = { x };
std::vector<Scalar> serials = { serial };
Expand Down Expand Up @@ -88,7 +88,7 @@ bool SigmaExtendedVerifier::batchverify(
const std::vector<GroupElement>& commits,
const std::vector<Scalar>& challenges,
const std::vector<Scalar>& serials,
const std::vector<size_t>& setSizes,
const std::vector<std::size_t>& setSizes,
const std::vector<SigmaExtendedProof>& proofs) const {

return verify(
Expand All @@ -107,7 +107,7 @@ bool SigmaExtendedVerifier::verify(
const std::vector<GroupElement>& commits,
const std::vector<Scalar>& challenges,
const std::vector<Scalar>& serials,
const std::vector<size_t>& setSizes,
const std::vector<std::size_t>& setSizes,
const bool commonChallenge,
const bool specifiedSetSizes,
const std::vector<SigmaExtendedProof>& proofs) const {
Expand Down Expand Up @@ -164,7 +164,7 @@ bool SigmaExtendedVerifier::verify(
std::vector<Scalar> commit_scalars; // associated to commitment list
h_scalars.reserve(n * m);
h_scalars.resize(n * m);
for (size_t i = 0; i < n * m; i++) {
for (std::size_t i = 0; i < n * m; i++) {
h_scalars[i] = Scalar(uint64_t(0));
}
commit_scalars.reserve(commits.size());
Expand Down Expand Up @@ -259,9 +259,9 @@ bool SigmaExtendedVerifier::verify(

Scalar pow(uint64_t(1));
std::vector<Scalar> f_part_product;
for (std::size_t j = m; j > 0; j--) {
for (std::ptrdiff_t j = m - 1; j >= 0; j--) {
f_part_product.push_back(pow);
pow *= f_[(j - 1) * n + I_[setSize - 1][j - 1]];
pow *= f_[j*n + I_[setSize - 1][j]];
}

NthPower xj(x);
Expand Down Expand Up @@ -426,7 +426,7 @@ void SigmaExtendedVerifier::compute_batch_fis(

Scalar t;

for (int i = 0; i < n; i++)
for (std::size_t i = 0; i < n; i++)
{
t = f[j * n + i];
t *= f_i;
Expand Down

0 comments on commit 4003efb

Please sign in to comment.