Skip to content

Commit

Permalink
use correct Fq and Fr for tom-256 and remove overridden method
Browse files Browse the repository at this point in the history
Signed-off-by: lovesh <[email protected]>
  • Loading branch information
lovesh committed Jan 29, 2025
1 parent bd72258 commit f90020f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 19 deletions.
2 changes: 1 addition & 1 deletion curves/tom_256/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "ark-tom256"
version.workspace = true
authors.workspace = true
description = "The secp256k1 curve"
description = "The Tom-256 curve"
homepage.workspace = true
repository.workspace = true
documentation = "https://docs.rs/ark-tom256/"
Expand Down
16 changes: 6 additions & 10 deletions curves/tom_256/src/curves/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use ark_ec::{
models::CurveConfig,
short_weierstrass::{self as sw, SWCurveConfig},
};
use ark_ff::{Field, MontFp, Zero};
use ark_ff::{Field, MontFp};

use crate::{fq::Fq, fr::Fr};

Expand All @@ -29,24 +29,20 @@ impl CurveConfig for Config {

impl SWCurveConfig for Config {
/// COEFF_A = 115792089210356248762697446949407573530594504085698471288169790229257723883796
const COEFF_A: Fq = MontFp!("115792089210356248762697446949407573530594504085698471288169790229257723883796");
const COEFF_A: Fq =
MontFp!("115792089210356248762697446949407573530594504085698471288169790229257723883796");

/// COEFF_B = 81531206846337786915455327229510804132577517753388365729879493166393691077718
const COEFF_B: Fq = MontFp!("81531206846337786915455327229510804132577517753388365729879493166393691077718");
const COEFF_B: Fq =
MontFp!("81531206846337786915455327229510804132577517753388365729879493166393691077718");

/// GENERATOR = (G_GENERATOR_X, G_GENERATOR_Y)
const GENERATOR: Affine = Affine::new_unchecked(G_GENERATOR_X, G_GENERATOR_Y);

#[inline(always)]
fn mul_by_a(_: Self::BaseField) -> Self::BaseField {
Self::BaseField::zero()
}
}

/// G_GENERATOR_X =
/// 3
pub const G_GENERATOR_X: Fq =
MontFp!("3");
pub const G_GENERATOR_X: Fq = MontFp!("3");

/// G_GENERATOR_Y =
/// 40902200210088653215032584946694356296222563095503428277299570638400093548589
Expand Down
8 changes: 4 additions & 4 deletions curves/tom_256/src/fields/fq.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use ark_ff::fields::{Fp256, MontBackend, MontConfig};

#[derive(MontConfig)]
#[modulus = "115792089210356248762697446949407573530086143415290314195533631308867097853951"]
#[generator = "3"]
#[small_subgroup_base = "3"]
#[small_subgroup_power = "1"]
#[modulus = "115792089210356248762697446949407573530594504085698471288169790229257723883799"]
#[generator = "6"]
// #[small_subgroup_base = "3"]
// #[small_subgroup_power = "1"]
pub struct FqConfig;
pub type Fq = Fp256<MontBackend<FqConfig, 4>>;
8 changes: 4 additions & 4 deletions curves/tom_256/src/fields/fr.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use ark_ff::fields::{Fp256, MontBackend, MontConfig};

#[derive(MontConfig)]
#[modulus = "115792089210356248762697446949407573530594504085698471288169790229257723883799"]
#[generator = "7"]
#[small_subgroup_base = "3"]
#[small_subgroup_power = "1"]
#[modulus = "115792089210356248762697446949407573530086143415290314195533631308867097853951"]
#[generator = "6"]
// #[small_subgroup_base = "3"]
// #[small_subgroup_power = "1"]
pub struct FrConfig;
pub type Fr = Fp256<MontBackend<FrConfig, 4>>;

0 comments on commit f90020f

Please sign in to comment.