From 21ffa8f949d769b6839cbaa2b2cc70442228a8a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20G=C3=B3rny?= Date: Thu, 30 Dec 2021 17:14:58 +0100 Subject: [PATCH] Move COFACTOR & COFACTOR_INV to ModelParameters --- ec/src/hashing/tests.rs | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/ec/src/hashing/tests.rs b/ec/src/hashing/tests.rs index 570e8c2d4..9d044d3b6 100644 --- a/ec/src/hashing/tests.rs +++ b/ec/src/hashing/tests.rs @@ -106,6 +106,11 @@ const F127_ONE: F127 = field_new!(F127, "1"); struct TestSWUMapToCurveParams; impl ModelParameters for TestSWUMapToCurveParams { + const COFACTOR: &'static [u64] = &[1]; + + #[rustfmt::skip] + const COFACTOR_INV: F127 = F127_ONE; + type BaseField = F127; type ScalarField = F127; } @@ -131,11 +136,6 @@ impl SWModelParameters for TestSWUMapToCurveParams { #[rustfmt::skip] const COEFF_B: F127 = field_new!(F127, "63"); - const COFACTOR: &'static [u64] = &[1]; - - #[rustfmt::skip] - const COFACTOR_INV: F127 = F127_ONE; - /// AFFINE_GENERATOR_COEFFS = (G1_GENERATOR_X, G1_GENERATOR_Y) const AFFINE_GENERATOR_COEFFS: (Self::BaseField, Self::BaseField) = (field_new!(F127, "62"), field_new!(F127, "70")); @@ -238,6 +238,11 @@ struct TestSWU127MapToIsogenousCurveParams; /// sage: E_isogenous.order() /// 127 impl ModelParameters for TestSWU127MapToIsogenousCurveParams { + const COFACTOR: &'static [u64] = &[1]; + + #[rustfmt::skip] + const COFACTOR_INV: F127 = F127_ONE; + type BaseField = F127; type ScalarField = F127; } @@ -252,11 +257,6 @@ impl SWModelParameters for TestSWU127MapToIsogenousCurveParams { #[rustfmt::skip] const COEFF_B: F127 = field_new!(F127, "124"); - const COFACTOR: &'static [u64] = &[1]; - - #[rustfmt::skip] - const COFACTOR_INV: F127 = F127_ONE; - /// AFFINE_GENERATOR_COEFFS = (G1_GENERATOR_X, G1_GENERATOR_Y) const AFFINE_GENERATOR_COEFFS: (Self::BaseField, Self::BaseField) = (field_new!(F127, "84"), field_new!(F127, "2")); @@ -276,6 +276,11 @@ impl SWUParams for TestSWU127MapToIsogenousCurveParams { struct TestWBF127MapToCurveParams; impl ModelParameters for TestWBF127MapToCurveParams { + const COFACTOR: &'static [u64] = &[1]; + + #[rustfmt::skip] + const COFACTOR_INV: F127 = F127_ONE; + type BaseField = F127; type ScalarField = F127; } @@ -290,11 +295,6 @@ impl SWModelParameters for TestWBF127MapToCurveParams { #[rustfmt::skip] const COEFF_B: F127 = field_new!(F127, "3"); - const COFACTOR: &'static [u64] = &[1]; - - #[rustfmt::skip] - const COFACTOR_INV: F127 = F127_ONE; - /// AFFINE_GENERATOR_COEFFS = (G1_GENERATOR_X, G1_GENERATOR_Y) const AFFINE_GENERATOR_COEFFS: (Self::BaseField, Self::BaseField) = (field_new!(F127, "62"), field_new!(F127, "70"));