Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,26 @@ edition = "2021"

[dependencies]
crossbeam-channel = "0.5"
ark-ff = { version = "0.4.2", default-features = false }
ark-ec = { version = "0.4.2", default-features = false }
ark-serialize = { version = "^0.4.2", default-features = false, features = [ "derive" ] }
ark-poly = { version = "^0.4.2", default-features = false }
ark-std = { version = "^0.4.0", default-features = false }
ark-relations = { version = "^0.4.0", default-features = false }
ark-crypto-primitives = { version = "^0.4.0", default-features = false }
ark-groth16 = { version = "^0.4.0", default-features = false }
rand = { version = "0.8" }
rand_core = { version = "^0.6" }
ark-ff = { version = "0.5.0", default-features = false }
ark-ec = { version = "0.5.0", default-features = false }
ark-serialize = { version = "^0.5.0", default-features = false, features = ["derive"] }
ark-poly = { version = "^0.5.0", default-features = false }
ark-std = { version = "^0.5.0", default-features = false }
ark-relations = { version = "^0.5.1", default-features = false }
ark-crypto-primitives = { version = "^0.5.0", default-features = false }
ark-groth16 = { version = "^0.5.0", default-features = false }
rand = "0.8"
rand_core = "^0.6"
digest = { version = "0.10.7" }
sha2 = { version = "^0.10" }
rayon = { version = "1", optional = true }
thiserror = { version = "^1.0" }
thiserror = "^2.0"
merlin = { version = "^3.0" }

[dev-dependencies]
ark-bls12-381 = { version = "^0.4.0", default-features = false, features = ["curve"] }
ark-bls12-381 = { version = "^0.5.0", default-features = false, features = ["curve"] }
rand_chacha = "0.3"
criterion = "0.5.1"
criterion = "0.7.0"

[features]
default = ["parallel"]
Expand Down
2 changes: 1 addition & 1 deletion src/commitment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
/// The first one is a commitment scheme that commits to a single vector $a$ of
/// length n in the second base group $G_1$ (for example):
/// * it requires a structured SRS $v_1$ of the form $(h,h^u,h^{u^2}, ...
/// ,g^{h^{n-1}})$ with $h \in G_2$ being a random generator of $G_2$ and $u$ a

Check warning on line 17 in src/commitment.rs

View workflow job for this annotation

GitHub Actions / clippy

doc list item without indentation
/// random scalar (coming from a power of tau ceremony for example)

Check warning on line 18 in src/commitment.rs

View workflow job for this annotation

GitHub Actions / clippy

doc list item without indentation
/// * it requires a second structured SRS $v_2$ of the form $(h,h^v,h^{v^2},
/// ...$ with $v$ being a random scalar different than u (coming from another

Check warning on line 20 in src/commitment.rs

View workflow job for this annotation

GitHub Actions / clippy

doc list item without indentation
/// power of tau ceremony for example)

Check warning on line 21 in src/commitment.rs

View workflow job for this annotation

GitHub Actions / clippy

doc list item without indentation
/// The Commitment is a tuple $(\prod_{i=0}^{n-1} e(a_i,v_{1,i}),

Check warning on line 22 in src/commitment.rs

View workflow job for this annotation

GitHub Actions / clippy

doc list item without indentation
/// \prod_{i=0}^{n-1} e(a_i,v_{2,i}))$
///
/// The second one takes two vectors $a \in G_1^n$ and $b \in G_2^n$ and commits
Expand Down Expand Up @@ -86,7 +86,7 @@
})
.unzip();

Ok(Self { a: a, b: b })

Check warning on line 89 in src/commitment.rs

View workflow job for this annotation

GitHub Actions / clippy

redundant field names in struct initialization

Check warning on line 89 in src/commitment.rs

View workflow job for this annotation

GitHub Actions / clippy

redundant field names in struct initialization
}

/// Returns the left and right commitment key part. It makes copy.
Expand Down Expand Up @@ -128,7 +128,7 @@
})
.unzip();

Ok(Self { a: a, b: b })

Check warning on line 131 in src/commitment.rs

View workflow job for this annotation

GitHub Actions / clippy

redundant field names in struct initialization

Check warning on line 131 in src/commitment.rs

View workflow job for this annotation

GitHub Actions / clippy

redundant field names in struct initialization
}

/// Returns the first values in the vector of v1 and v2 (respectively
Expand Down Expand Up @@ -192,7 +192,7 @@
use super::*;
use crate::srs::structured_generators_scalar_power;
use ark_bls12_381::{Bls12_381 as Bls12, Fr, G1Projective, G2Projective};
use ark_ec::Group;
use ark_ec::PrimeGroup;
use ark_std::UniformRand;
use rand_core::SeedableRng;

Expand Down
21 changes: 6 additions & 15 deletions src/srs.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use ark_ec::scalar_mul::fixed_base::FixedBase;
use ark_ec::scalar_mul::BatchMulPreprocessing;
// msm::FixedBaseMSM;
use ark_ec::{pairing::Pairing, AffineRepr, CurveGroup, Group};
use ark_ec::{pairing::Pairing, AffineRepr, CurveGroup, PrimeGroup};
// {AffineCurve, PairingEngine, ProjectiveCurve};
use ark_ff::PrimeField;
use ark_serialize::{CanonicalDeserialize, CanonicalSerialize, SerializationError};
use ark_std::{rand::Rng, One, UniformRand};
use sha2::{Digest, Sha256};
Expand Down Expand Up @@ -163,7 +162,7 @@
n,
};
let vk = VerifierSRS::<E> {
n: n,

Check warning on line 165 in src/srs.rs

View workflow job for this annotation

GitHub Actions / clippy

redundant field names in struct initialization
g: self.g_alpha_powers[0].into_group(),
h: self.h_alpha_powers[0].into_group(),
g_alpha: self.g_alpha_powers[1].into_group(),
Expand Down Expand Up @@ -299,20 +298,12 @@
powers_of_scalar.push(pow_s);
pow_s.mul_assign(s);
}
let scalar_bits = G::ScalarField::MODULUS_BIT_SIZE as usize;
let window_size = FixedBase::get_mul_window_size(num);
let g_table = FixedBase::get_window_table::<G>(scalar_bits, window_size, g.clone());
let powers_of_g = FixedBase::msm::<G>(
//let powers_of_g = msm::fixed_base::multi_scalar_mul::<G>(
scalar_bits,
window_size,
&g_table,
&powers_of_scalar[..],
);
powers_of_g.into_iter().map(|v| v.into_affine()).collect()

let g_table = BatchMulPreprocessing::new(g.clone(), num);
g_table.batch_mul(&powers_of_scalar[..])
}

fn write_vec<G: Group, W: Write>(mut w: W, v: &[G]) -> Result<(), SerializationError> {
fn write_vec<G: PrimeGroup, W: Write>(mut w: W, v: &[G]) -> Result<(), SerializationError> {
for p in v {
p.serialize_compressed(&mut w)?;
}
Expand Down
2 changes: 1 addition & 1 deletion src/transcript.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ impl Transcript for Merlin {
mod test {
use super::*;
use ark_bls12_381::{Fr, G1Projective};
use ark_ec::Group;
use ark_ec::PrimeGroup;

#[test]
fn transcript() {
Expand Down
Loading