File tree 8 files changed +797
-587
lines changed
elliptic_curve/short_weierstrass/curves
8 files changed +797
-587
lines changed Original file line number Diff line number Diff line change @@ -147,20 +147,22 @@ where
147
147
#[ cfg( test) ]
148
148
mod tests {
149
149
use lambdaworks_math:: {
150
- field:: fields:: u384_prime_field:: { IsMontgomeryConfiguration , MontgomeryBackendPrimeField } ,
150
+ field:: fields:: montgomery_backed_prime_fields:: {
151
+ IsMontgomeryConfiguration , U384PrimeField ,
152
+ } ,
151
153
unsigned_integer:: element:: U384 ,
152
154
} ;
153
155
154
156
use super :: * ;
155
157
156
158
#[ derive( Clone , Debug ) ]
157
159
pub struct TestFieldConfig ;
158
- impl IsMontgomeryConfiguration for TestFieldConfig {
160
+ impl IsMontgomeryConfiguration < 6 > for TestFieldConfig {
159
161
const MODULUS : U384 =
160
162
U384 :: from ( "2000000000000080000000000000000000000000000000000000000000000001" ) ;
161
163
}
162
164
163
- pub type PoseidonTestField = MontgomeryBackendPrimeField < TestFieldConfig > ;
165
+ pub type PoseidonTestField = U384PrimeField < TestFieldConfig > ;
164
166
type TestFieldElement = FieldElement < PoseidonTestField > ;
165
167
166
168
pub fn load_test_parameters ( ) -> Result < Parameters < PoseidonTestField > , String > {
Original file line number Diff line number Diff line change 1
1
use crate :: field:: {
2
2
element:: FieldElement ,
3
- fields:: u384_prime_field:: { IsMontgomeryConfiguration , MontgomeryBackendPrimeField } ,
3
+ fields:: montgomery_backed_prime_fields:: {
4
+ IsMontgomeryConfiguration , MontgomeryBackendPrimeField ,
5
+ } ,
4
6
} ;
5
7
use crate :: unsigned_integer:: element:: U384 ;
6
8
@@ -9,11 +11,11 @@ pub const BLS12377_PRIME_FIELD_ORDER: U384 = U384::from("1ae3a4617c510eac63b05c0
9
11
// FPBLS12377
10
12
#[ derive( Clone , Debug ) ]
11
13
pub struct BLS12377FieldConfig ;
12
- impl IsMontgomeryConfiguration for BLS12377FieldConfig {
14
+ impl IsMontgomeryConfiguration < 6 > for BLS12377FieldConfig {
13
15
const MODULUS : U384 = BLS12377_PRIME_FIELD_ORDER ;
14
16
}
15
17
16
- pub type BLS12377PrimeField = MontgomeryBackendPrimeField < BLS12377FieldConfig > ;
18
+ pub type BLS12377PrimeField = MontgomeryBackendPrimeField < BLS12377FieldConfig , 6 > ;
17
19
18
20
impl FieldElement < BLS12377PrimeField > {
19
21
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::{
4
4
cubic:: { CubicExtensionField , HasCubicNonResidue } ,
5
5
quadratic:: { HasQuadraticNonResidue , QuadraticExtensionField } ,
6
6
} ,
7
- fields:: u384_prime_field:: { IsMontgomeryConfiguration , MontgomeryBackendPrimeField } ,
7
+ fields:: montgomery_backed_prime_fields:: {
8
+ IsMontgomeryConfiguration , MontgomeryBackendPrimeField ,
9
+ } ,
8
10
} ;
9
11
use crate :: unsigned_integer:: element:: U384 ;
10
12
@@ -13,11 +15,11 @@ pub const BLS12381_PRIME_FIELD_ORDER: U384 = U384::from("1a0111ea397fe69a4b1ba7b
13
15
// FPBLS12381
14
16
#[ derive( Clone , Debug ) ]
15
17
pub struct BLS12381FieldConfig ;
16
- impl IsMontgomeryConfiguration for BLS12381FieldConfig {
18
+ impl IsMontgomeryConfiguration < 6 > for BLS12381FieldConfig {
17
19
const MODULUS : U384 = BLS12381_PRIME_FIELD_ORDER ;
18
20
}
19
21
20
- pub type BLS12381PrimeField = MontgomeryBackendPrimeField < BLS12381FieldConfig > ;
22
+ pub type BLS12381PrimeField = MontgomeryBackendPrimeField < BLS12381FieldConfig , 6 > ;
21
23
22
24
#[ derive( Debug , Clone ) ]
23
25
pub struct LevelOneResidue ;
Original file line number Diff line number Diff line change 1
1
use crate :: elliptic_curve:: short_weierstrass:: point:: ShortWeierstrassProjectivePoint ;
2
2
use crate :: elliptic_curve:: traits:: IsEllipticCurve ;
3
- use crate :: field:: fields:: u384_prime_field :: {
3
+ use crate :: field:: fields:: montgomery_backed_prime_fields :: {
4
4
IsMontgomeryConfiguration , MontgomeryBackendPrimeField ,
5
5
} ;
6
6
use crate :: unsigned_integer:: element:: U384 ;
@@ -21,11 +21,11 @@ pub const TEST_CURVE_2_MAIN_SUBGROUP_ORDER: U384 = U384::from("40a065fb5a76390de
21
21
// FPBLS12381
22
22
#[ derive( Clone , Debug ) ]
23
23
pub struct TestCurve2MontgomeryConfig ;
24
- impl IsMontgomeryConfiguration for TestCurve2MontgomeryConfig {
24
+ impl IsMontgomeryConfiguration < 6 > for TestCurve2MontgomeryConfig {
25
25
const MODULUS : U384 = TEST_CURVE_2_PRIME_FIELD_ORDER ;
26
26
}
27
27
28
- type TestCurve2PrimeField = MontgomeryBackendPrimeField < TestCurve2MontgomeryConfig > ;
28
+ type TestCurve2PrimeField = MontgomeryBackendPrimeField < TestCurve2MontgomeryConfig , 6 > ;
29
29
30
30
/// In F59 the element -1 is not a square. We use this property
31
31
/// 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 ;
2
2
/// Implementation of prime fields over 64 bit unsigned integers.
3
3
pub mod u64_prime_field;
You can’t perform that action at this time.
0 commit comments