Skip to content
This repository has been archived by the owner on Dec 18, 2023. It is now read-only.

Commit

Permalink
Add supplementary small group bases for some common fields (#137)
Browse files Browse the repository at this point in the history
* update

* use r1cs std

* fix

* rem

* Apply suggestions from code review

Co-authored-by: onewayfunc <onewayfunc@gmail.com>
  • Loading branch information
weikengchen and onewayfunc authored Dec 22, 2022
1 parent febd763 commit a82486d
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 17 deletions.
8 changes: 5 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ debug-assertions = true
debug = true

[patch.crates-io]
ark-ff = { git = "https://github.com/arkworks-rs/algebra/", branch = "release-0.4" }
ark-ec = { git = "https://github.com/arkworks-rs/algebra/", branch = "release-0.4" }
ark-ff = { git = "https://github.com/arkworks-rs/algebra/", branch = "release-0.4-debug-secp256k1" }
ark-ec = { git = "https://github.com/arkworks-rs/algebra/", branch = "release-0.4-debug-secp256k1" }
ark-poly = { git = "https://github.com/arkworks-rs/algebra/", branch = "release-0.4" }
ark-serialize = { git = "https://github.com/arkworks-rs/algebra/", branch = "release-0.4" }
ark-serialize = { git = "https://github.com/arkworks-rs/algebra/", branch = "release-0.4-debug-secp256k1" }
ark-algebra-test-templates = { git = "https://github.com/arkworks-rs/algebra/", branch = "release-0.4-debug-secp256k1" }
ark-r1cs-std = { git = "https://github.com/arkworks-rs/r1cs-std/", branch = "release-0.4" }
2 changes: 2 additions & 0 deletions bls12_381/src/fields/fq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@ use ark_ff::fields::{Fp384, MontBackend, MontConfig};
#[derive(MontConfig)]
#[modulus = "4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559787"]
#[generator = "2"]
#[small_subgroup_base = "3"]
#[small_subgroup_power = "2"]
pub struct FqConfig;
pub type Fq = Fp384<MontBackend<FqConfig, 6>>;
2 changes: 2 additions & 0 deletions bls12_381/src/fields/fr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@ use ark_ff::fields::{Fp256, MontBackend, MontConfig};
#[derive(MontConfig)]
#[modulus = "52435875175126190479447740508185965837690552500527637822603658699938581184513"]
#[generator = "7"]
#[small_subgroup_base = "3"]
#[small_subgroup_power = "1"]
pub struct FrConfig;
pub type Fr = Fp256<MontBackend<FrConfig, 4>>;
2 changes: 2 additions & 0 deletions curve25519/src/fields/fq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@ use ark_ff::fields::{Fp256, MontBackend, MontConfig};
#[derive(MontConfig)]
#[modulus = "57896044618658097711785492504343953926634992332820282019728792003956564819949"]
#[generator = "2"]
#[small_subgroup_base = "3"]
#[small_subgroup_power = "1"]
pub struct FqConfig;
pub type Fq = Fp256<MontBackend<FqConfig, 4>>;
2 changes: 2 additions & 0 deletions curve25519/src/fields/fr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@ use ark_ff::fields::{Fp256, MontBackend, MontConfig};
#[derive(MontConfig)]
#[modulus = "7237005577332262213973186563042994240857116359379907606001950938285454250989"]
#[generator = "2"]
#[small_subgroup_base = "3"]
#[small_subgroup_power = "1"]
pub struct FrConfig;
pub type Fr = Fp256<MontBackend<FrConfig, 4>>;
1 change: 1 addition & 0 deletions ed25519/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ ark-ff = { version = "0.4.0-alpha", default-features = false }
ark-ec = { version = "0.4.0-alpha", default-features = false }
ark-std = { version = "0.4.0-alpha", default-features = false }
ark-r1cs-std = { version = "0.4.0-alpha", default-features = false, optional = true }
ark-curve25519 = { path = "../curve25519" }

[dev-dependencies]
ark-relations = { version = "0.4.0-alpha", default-features = false }
Expand Down
8 changes: 1 addition & 7 deletions ed25519/src/fields/fq.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
use ark_ff::fields::{Fp256, MontBackend, MontConfig};

#[derive(MontConfig)]
#[modulus = "57896044618658097711785492504343953926634992332820282019728792003956564819949"]
#[generator = "2"]
pub struct FqConfig;
pub type Fq = Fp256<MontBackend<FqConfig, 4>>;
pub use ark_curve25519::{Fq, FqConfig};
8 changes: 1 addition & 7 deletions ed25519/src/fields/fr.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
use ark_ff::fields::{Fp256, MontBackend, MontConfig};

#[derive(MontConfig)]
#[modulus = "7237005577332262213973186563042994240857116359379907606001950938285454250989"]
#[generator = "2"]
pub struct FrConfig;
pub type Fr = Fp256<MontBackend<FrConfig, 4>>;
pub use ark_curve25519::{Fr, FrConfig};
2 changes: 2 additions & 0 deletions secp256k1/src/fields/fq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@ use ark_ff::fields::{Fp256, MontBackend, MontConfig};
#[derive(MontConfig)]
#[modulus = "115792089237316195423570985008687907853269984665640564039457584007908834671663"]
#[generator = "3"]
#[small_subgroup_base = "3"]
#[small_subgroup_power = "1"]
pub struct FqConfig;
pub type Fq = Fp256<MontBackend<FqConfig, 4>>;
2 changes: 2 additions & 0 deletions secp256k1/src/fields/fr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@ use ark_ff::fields::{Fp256, MontBackend, MontConfig};
#[derive(MontConfig)]
#[modulus = "115792089237316195423570985008687907852837564279074904382605163141518161494337"]
#[generator = "7"]
#[small_subgroup_base = "3"]
#[small_subgroup_power = "1"]
pub struct FrConfig;
pub type Fr = Fp256<MontBackend<FrConfig, 4>>;

0 comments on commit a82486d

Please sign in to comment.