File tree Expand file tree Collapse file tree 8 files changed +797
-587
lines changed
elliptic_curve/short_weierstrass/curves Expand file tree Collapse file tree 8 files changed +797
-587
lines changed Original file line number Diff line number Diff line change @@ -147,20 +147,22 @@ where
147147#[ cfg( test) ]
148148mod tests {
149149 use lambdaworks_math:: {
150- field:: fields:: u384_prime_field:: { IsMontgomeryConfiguration , MontgomeryBackendPrimeField } ,
150+ field:: fields:: montgomery_backed_prime_fields:: {
151+ IsMontgomeryConfiguration , U384PrimeField ,
152+ } ,
151153 unsigned_integer:: element:: U384 ,
152154 } ;
153155
154156 use super :: * ;
155157
156158 #[ derive( Clone , Debug ) ]
157159 pub struct TestFieldConfig ;
158- impl IsMontgomeryConfiguration for TestFieldConfig {
160+ impl IsMontgomeryConfiguration < 6 > for TestFieldConfig {
159161 const MODULUS : U384 =
160162 U384 :: from ( "2000000000000080000000000000000000000000000000000000000000000001" ) ;
161163 }
162164
163- pub type PoseidonTestField = MontgomeryBackendPrimeField < TestFieldConfig > ;
165+ pub type PoseidonTestField = U384PrimeField < TestFieldConfig > ;
164166 type TestFieldElement = FieldElement < PoseidonTestField > ;
165167
166168 pub fn load_test_parameters ( ) -> Result < Parameters < PoseidonTestField > , String > {
Original file line number Diff line number Diff line change 11use crate :: field:: {
22 element:: FieldElement ,
3- fields:: u384_prime_field:: { IsMontgomeryConfiguration , MontgomeryBackendPrimeField } ,
3+ fields:: montgomery_backed_prime_fields:: {
4+ IsMontgomeryConfiguration , MontgomeryBackendPrimeField ,
5+ } ,
46} ;
57use crate :: unsigned_integer:: element:: U384 ;
68
@@ -9,11 +11,11 @@ pub const BLS12377_PRIME_FIELD_ORDER: U384 = U384::from("1ae3a4617c510eac63b05c0
911// FPBLS12377
1012#[ derive( Clone , Debug ) ]
1113pub struct BLS12377FieldConfig ;
12- impl IsMontgomeryConfiguration for BLS12377FieldConfig {
14+ impl IsMontgomeryConfiguration < 6 > for BLS12377FieldConfig {
1315 const MODULUS : U384 = BLS12377_PRIME_FIELD_ORDER ;
1416}
1517
16- pub type BLS12377PrimeField = MontgomeryBackendPrimeField < BLS12377FieldConfig > ;
18+ pub type BLS12377PrimeField = MontgomeryBackendPrimeField < BLS12377FieldConfig , 6 > ;
1719
1820impl FieldElement < BLS12377PrimeField > {
1921 pub fn new_base ( a_hex : & str ) -> Self {
Original file line number Diff line number Diff line change @@ -4,7 +4,9 @@ use crate::field::{
44 cubic:: { CubicExtensionField , HasCubicNonResidue } ,
55 quadratic:: { HasQuadraticNonResidue , QuadraticExtensionField } ,
66 } ,
7- fields:: u384_prime_field:: { IsMontgomeryConfiguration , MontgomeryBackendPrimeField } ,
7+ fields:: montgomery_backed_prime_fields:: {
8+ IsMontgomeryConfiguration , MontgomeryBackendPrimeField ,
9+ } ,
810} ;
911use crate :: unsigned_integer:: element:: U384 ;
1012
@@ -13,11 +15,11 @@ pub const BLS12381_PRIME_FIELD_ORDER: U384 = U384::from("1a0111ea397fe69a4b1ba7b
1315// FPBLS12381
1416#[ derive( Clone , Debug ) ]
1517pub struct BLS12381FieldConfig ;
16- impl IsMontgomeryConfiguration for BLS12381FieldConfig {
18+ impl IsMontgomeryConfiguration < 6 > for BLS12381FieldConfig {
1719 const MODULUS : U384 = BLS12381_PRIME_FIELD_ORDER ;
1820}
1921
20- pub type BLS12381PrimeField = MontgomeryBackendPrimeField < BLS12381FieldConfig > ;
22+ pub type BLS12381PrimeField = MontgomeryBackendPrimeField < BLS12381FieldConfig , 6 > ;
2123
2224#[ derive( Debug , Clone ) ]
2325pub struct LevelOneResidue ;
Original file line number Diff line number Diff line change 11use crate :: elliptic_curve:: short_weierstrass:: point:: ShortWeierstrassProjectivePoint ;
22use crate :: elliptic_curve:: traits:: IsEllipticCurve ;
3- use crate :: field:: fields:: u384_prime_field :: {
3+ use crate :: field:: fields:: montgomery_backed_prime_fields :: {
44 IsMontgomeryConfiguration , MontgomeryBackendPrimeField ,
55} ;
66use crate :: unsigned_integer:: element:: U384 ;
@@ -21,11 +21,11 @@ pub const TEST_CURVE_2_MAIN_SUBGROUP_ORDER: U384 = U384::from("40a065fb5a76390de
2121// FPBLS12381
2222#[ derive( Clone , Debug ) ]
2323pub struct TestCurve2MontgomeryConfig ;
24- impl IsMontgomeryConfiguration for TestCurve2MontgomeryConfig {
24+ impl IsMontgomeryConfiguration < 6 > for TestCurve2MontgomeryConfig {
2525 const MODULUS : U384 = TEST_CURVE_2_PRIME_FIELD_ORDER ;
2626}
2727
28- type TestCurve2PrimeField = MontgomeryBackendPrimeField < TestCurve2MontgomeryConfig > ;
28+ type TestCurve2PrimeField = MontgomeryBackendPrimeField < TestCurve2MontgomeryConfig , 6 > ;
2929
3030/// In F59 the element -1 is not a square. We use this property
3131/// to construct a Quadratic Field Extension out of it by adding
Original file line number Diff line number Diff line change 1- pub mod u384_prime_field ;
1+ pub mod montgomery_backed_prime_fields ;
22/// Implementation of prime fields over 64 bit unsigned integers.
33pub mod u64_prime_field;
You can’t perform that action at this time.
0 commit comments