-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
use crate::Fq; | ||
|
||
#[derive(Clone, Default, PartialEq, Eq)] | ||
pub struct Decaf377EdwardsConfig; | ||
|
||
// These types should not be exported. They are similar to `EdwardsAffine` and | ||
// `EdwardsProjective` from the `ark_ed_on_bls12_377` crate, except using our own | ||
// `Decaf377Config` that has the cofactor set to 1. Consumers of this | ||
// library should use the `AffineElement` and `Element` (projective) | ||
// types. | ||
pub type EdwardsAffine = Affine<Decaf377EdwardsConfig>; | ||
Check failure on line 11 in src/ark_curve/edwards.rs GitHub Actions / Check
Check failure on line 11 in src/ark_curve/edwards.rs GitHub Actions / no_std compatibility check
Check failure on line 11 in src/ark_curve/edwards.rs GitHub Actions / build without alloc
Check failure on line 11 in src/ark_curve/edwards.rs GitHub Actions / Test Suite (r1cs,u32_backend)
|
||
pub type EdwardsProjective = Projective<Decaf377EdwardsConfig>; | ||
Check failure on line 12 in src/ark_curve/edwards.rs GitHub Actions / Check
Check failure on line 12 in src/ark_curve/edwards.rs GitHub Actions / no_std compatibility check
Check failure on line 12 in src/ark_curve/edwards.rs GitHub Actions / build without alloc
Check failure on line 12 in src/ark_curve/edwards.rs GitHub Actions / Test Suite (r1cs,u32_backend)
|
||
|
||
impl CurveConfig for Decaf377EdwardsConfig { | ||
Check failure on line 14 in src/ark_curve/edwards.rs GitHub Actions / Check
Check failure on line 14 in src/ark_curve/edwards.rs GitHub Actions / no_std compatibility check
Check failure on line 14 in src/ark_curve/edwards.rs GitHub Actions / build without alloc
Check failure on line 14 in src/ark_curve/edwards.rs GitHub Actions / Test Suite (r1cs,u32_backend)
|
||
type BaseField = Fq; | ||
type ScalarField = Fr; | ||
Check failure on line 16 in src/ark_curve/edwards.rs GitHub Actions / Check
Check failure on line 16 in src/ark_curve/edwards.rs GitHub Actions / no_std compatibility check
Check failure on line 16 in src/ark_curve/edwards.rs GitHub Actions / build without alloc
Check failure on line 16 in src/ark_curve/edwards.rs GitHub Actions / Test Suite (r1cs,u32_backend)
|
||
|
||
const COFACTOR: &'static [u64] = &[1]; | ||
|
||
const COFACTOR_INV: Fr = Fr::one(); | ||
Check failure on line 20 in src/ark_curve/edwards.rs GitHub Actions / Check
Check failure on line 20 in src/ark_curve/edwards.rs GitHub Actions / Check
Check failure on line 20 in src/ark_curve/edwards.rs GitHub Actions / no_std compatibility check
Check failure on line 20 in src/ark_curve/edwards.rs GitHub Actions / no_std compatibility check
Check failure on line 20 in src/ark_curve/edwards.rs GitHub Actions / build without alloc
Check failure on line 20 in src/ark_curve/edwards.rs GitHub Actions / build without alloc
Check failure on line 20 in src/ark_curve/edwards.rs GitHub Actions / Test Suite (r1cs,u32_backend)
Check failure on line 20 in src/ark_curve/edwards.rs GitHub Actions / Test Suite (r1cs,u32_backend)
Check failure on line 20 in src/ark_curve/edwards.rs GitHub Actions / Test Suite (r1cs)
|
||
} | ||
|
||
impl TECurveConfig for Decaf377EdwardsConfig { | ||
Check failure on line 23 in src/ark_curve/edwards.rs GitHub Actions / Check
Check failure on line 23 in src/ark_curve/edwards.rs GitHub Actions / no_std compatibility check
Check failure on line 23 in src/ark_curve/edwards.rs GitHub Actions / build without alloc
Check failure on line 23 in src/ark_curve/edwards.rs GitHub Actions / Test Suite (r1cs,u32_backend)
|
||
/// COEFF_A = -1 | ||
const COEFF_A: Fq = Fq::from_montgomery_limbs_64([ | ||
10157024534604021774, | ||
16668528035959406606, | ||
5322190058819395602, | ||
387181115924875961, | ||
]); | ||
|
||
/// COEFF_D = 3021 | ||
const COEFF_D: Fq = Fq::from_montgomery_limbs_64([ | ||
15008245758212136496, | ||
17341409599856531410, | ||
648869460136961410, | ||
719771289660577536, | ||
]); | ||
|
||
const GENERATOR: EdwardsAffine = EdwardsAffine::new_unchecked(GENERATOR_X, GENERATOR_Y); | ||
Check failure on line 40 in src/ark_curve/edwards.rs GitHub Actions / Check
Check failure on line 40 in src/ark_curve/edwards.rs GitHub Actions / Check
Check failure on line 40 in src/ark_curve/edwards.rs GitHub Actions / no_std compatibility check
Check failure on line 40 in src/ark_curve/edwards.rs GitHub Actions / no_std compatibility check
Check failure on line 40 in src/ark_curve/edwards.rs GitHub Actions / build without alloc
Check failure on line 40 in src/ark_curve/edwards.rs GitHub Actions / build without alloc
Check failure on line 40 in src/ark_curve/edwards.rs GitHub Actions / Test Suite (r1cs,u32_backend)
Check failure on line 40 in src/ark_curve/edwards.rs GitHub Actions / Test Suite (r1cs,u32_backend)
Check failure on line 40 in src/ark_curve/edwards.rs GitHub Actions / Test Suite (r1cs)
|
||
|
||
type MontCurveConfig = Decaf377EdwardsConfig; | ||
|
||
/// Multiplication by `a` is just negation. | ||
#[inline(always)] | ||
fn mul_by_a(elem: Self::BaseField) -> Self::BaseField { | ||
-elem | ||
} | ||
|
||
fn is_in_correct_subgroup_assuming_on_curve(_: &Affine<Self>) -> bool { | ||
Check failure on line 50 in src/ark_curve/edwards.rs GitHub Actions / Check
Check failure on line 50 in src/ark_curve/edwards.rs GitHub Actions / no_std compatibility check
Check failure on line 50 in src/ark_curve/edwards.rs GitHub Actions / build without alloc
Check failure on line 50 in src/ark_curve/edwards.rs GitHub Actions / Test Suite (r1cs,u32_backend)
|
||
true | ||
} | ||
} | ||
|
||
impl MontCurveConfig for Decaf377EdwardsConfig { | ||
const COEFF_A: Fq = Fq::from_montgomery_limbs_64([ | ||
13800168384327121454, | ||
6841573379969807446, | ||
12529593083398462246, | ||
853978956621483129, | ||
]); | ||
|
||
const COEFF_B: Fq = Fq::from_montgomery_limbs_64([ | ||
7239382437352637935, | ||
14509846070439283655, | ||
5083066350480839936, | ||
1265663645916442191, | ||
]); | ||
|
||
type TECurveConfig = Decaf377EdwardsConfig; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
mod edwards; |
This file was deleted.