Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
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
1 change: 1 addition & 0 deletions curves/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ members = [
"ed25519",

"starkcurve",
"jq255s",
]
resolver = "2"

Expand Down
38 changes: 38 additions & 0 deletions curves/jq255s/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[package]
name = "ark-jq255s"
version.workspace = true
authors.workspace = true
description = "The do255s curve"
homepage.workspace = true
repository.workspace = true
documentation = "https://docs.rs/ark-secp256r1/"
keywords.workspace = true
categories.workspace = true
include.workspace = true
license.workspace = true
edition.workspace = true

[dependencies]
ark-ff = { workspace = true }
ark-ec = { workspace = true }
ark-r1cs-std = { workspace = true, optional = true }
ark-std = { workspace = true }
hex = "0.4.3"

[dev-dependencies]
ark-relations = { workspace = true }
ark-serialize = { workspace = true }
ark-algebra-test-templates = { workspace = true }
ark-curve-constraint-tests = { path = "../curve-constraint-tests" }

[features]
default = []
std = [ "ark-std/std", "ark-ff/std", "ark-ec/std" ]
r1cs = [ "ark-r1cs-std" ]
asm = [ "ark-ff/asm" ]

#[patch.crates-io]
#ark-ec = { path = "../../algebra/ec" }
#ark-ff = { path = "../../algebra/ff" }
#ark-poly = { path = "../../algebra/poly" }
#ark-serialize = { path = "../../algebra/serialize" }
1 change: 1 addition & 0 deletions curves/jq255s/LICENSE-APACHE
1 change: 1 addition & 0 deletions curves/jq255s/LICENSE-MIT
5 changes: 5 additions & 0 deletions curves/jq255s/src/constraints/curves.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
use crate::{constraints::FqVar, *};
use ark_r1cs_std::groups::curves::short_weierstrass::ProjectiveVar;

/// A group element in the Jq255s curve.
pub type GVar = ProjectiveVar<Config, FqVar>;
11 changes: 11 additions & 0 deletions curves/jq255s/src/constraints/fields.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
use ark_r1cs_std::fields::fp::FpVar;

use crate::fq::Fq;

/// A variable that is the R1CS equivalent of `crate::Fq`.
pub type FqVar = FpVar<Fq>;

#[test]
fn test() {
ark_curve_constraint_tests::fields::field_test::<_, _, FqVar>().unwrap();
}
7 changes: 7 additions & 0 deletions curves/jq255s/src/constraints/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//! This module implements the R1CS equivalent of `ark_jq255s`.

mod curves;
mod fields;

pub use curves::*;
pub use fields::*;
48 changes: 48 additions & 0 deletions curves/jq255s/src/curves/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
use ark_ec::{
double_odd::{self as doo, DOCurveConfig},
models::CurveConfig,
};
use ark_ff::MontFp;

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

#[cfg(test)]
mod tests;

pub type Affine = doo::Affine<Config>;
pub type Projective = doo::Projective<Config>;

#[derive(Copy, Clone, Default, PartialEq, Eq)]
pub struct Config;

impl CurveConfig for Config {
type BaseField = Fq;
type ScalarField = Fr;

/// COFACTOR = 2
const COFACTOR: &'static [u64] = &[2];

#[rustfmt::skip]
const COFACTOR_INV: Fr = MontFp!("14474011154664524427946373126085988481687200150840406918337755177497658435940");
}

impl DOCurveConfig for Config {
/// COEFF_A = -1
const COEFF_A: Fq = MontFp!("-1");

/// COEFF_B = 1/2
const COEFF_B: Fq =
MontFp!("28948022309329048855892746252171976963317496166410141009864396001978282408006");

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

/// G_GENERATOR_X =
/// 0x0076aab95b2acbae4747482ba7081f7b94193dad9f96fdd2516283980459b09eaa
pub const G_GENERATOR_E: Fq =
MontFp!("6929650852805837546485348833751579670837850621479164143703164723313568683024");

/// G_GENERATOR_Y =
/// 0x00b7d601b4cb25f8249b65e89b8f584a5494e592f3895d54f9002202b0530e6fbc
pub const G_GENERATOR_U: Fq = MontFp!("3");
Loading
Loading