diff --git a/benchmarks-threadpool/black_scholes/threadpool_black_scholes.nim b/benchmarks-threadpool/black_scholes/threadpool_black_scholes.nim index e585b90f..63a8e76c 100644 --- a/benchmarks-threadpool/black_scholes/threadpool_black_scholes.nim +++ b/benchmarks-threadpool/black_scholes/threadpool_black_scholes.nim @@ -21,7 +21,7 @@ import # Stdlib system/ansi_c, std/[strformat, os, strutils, math, cpuinfo, streams, strscans], # Constantine - ../../constantine/threadpool + constantine/threadpool when defined(linux): # bench diff --git a/benchmarks-threadpool/bouncing_producer_consumer/threadpool_bpc.nim b/benchmarks-threadpool/bouncing_producer_consumer/threadpool_bpc.nim index 5865ead1..557f04b6 100644 --- a/benchmarks-threadpool/bouncing_producer_consumer/threadpool_bpc.nim +++ b/benchmarks-threadpool/bouncing_producer_consumer/threadpool_bpc.nim @@ -2,7 +2,7 @@ import # STD lib std/[os, strutils, cpuinfo, strformat, math], # Library - ../../constantine/threadpool, + constantine/threadpool, # bench ../wtime, ../resources diff --git a/benchmarks-threadpool/dfs/threadpool_dfs.nim b/benchmarks-threadpool/dfs/threadpool_dfs.nim index 9fc24137..fc299a83 100644 --- a/benchmarks-threadpool/dfs/threadpool_dfs.nim +++ b/benchmarks-threadpool/dfs/threadpool_dfs.nim @@ -9,7 +9,7 @@ import # Stdlib std/[strformat, os, strutils, cpuinfo], # Library - ../../constantine/threadpool + constantine/threadpool when not defined(windows): # bench diff --git a/benchmarks-threadpool/fibonacci/threadpool_fib.nim b/benchmarks-threadpool/fibonacci/threadpool_fib.nim index 3592a934..4f5781eb 100644 --- a/benchmarks-threadpool/fibonacci/threadpool_fib.nim +++ b/benchmarks-threadpool/fibonacci/threadpool_fib.nim @@ -2,7 +2,7 @@ import # STD lib std/[os, strutils, cpuinfo, strformat, math], # Library - ../../constantine/threadpool + constantine/threadpool when not defined(windows): # bench diff --git a/benchmarks-threadpool/heat/threadpool_heat.nim b/benchmarks-threadpool/heat/threadpool_heat.nim index d32a9187..37f6d18c 100644 --- a/benchmarks-threadpool/heat/threadpool_heat.nim +++ b/benchmarks-threadpool/heat/threadpool_heat.nim @@ -35,7 +35,7 @@ import # Stdlib system/ansi_c, std/[strformat, os, strutils, math, cpuinfo], # Library - ../../constantine/threadpool + constantine/threadpool when not defined(windows): # bench import ../wtime, ../resources diff --git a/benchmarks-threadpool/histogram_2D/threadpool_histogram.nim b/benchmarks-threadpool/histogram_2D/threadpool_histogram.nim index 67dd43d5..91675e7b 100644 --- a/benchmarks-threadpool/histogram_2D/threadpool_histogram.nim +++ b/benchmarks-threadpool/histogram_2D/threadpool_histogram.nim @@ -9,7 +9,7 @@ import # Stdlib system/ansi_c, std/[os, strutils, cpuinfo, math, strformat, locks], # Constantine - ../../constantine/threadpool + constantine/threadpool when not defined(windows): # bench diff --git a/benchmarks-threadpool/logsumexp/threadpool_logsumexp.nim b/benchmarks-threadpool/logsumexp/threadpool_logsumexp.nim index 760432ee..d7b7aec1 100644 --- a/benchmarks-threadpool/logsumexp/threadpool_logsumexp.nim +++ b/benchmarks-threadpool/logsumexp/threadpool_logsumexp.nim @@ -9,7 +9,7 @@ import # Stdlib system/ansi_c, std/[strformat, os, strutils, cpuinfo, math, random, locks], # Constantine - ../../constantine/threadpool + constantine/threadpool when not defined(windows): # bench @@ -399,4 +399,4 @@ proc main() = tp.shutdown() -main() \ No newline at end of file +main() diff --git a/benchmarks-threadpool/matmul_cache_oblivious/threadpool_matmul_co.nim b/benchmarks-threadpool/matmul_cache_oblivious/threadpool_matmul_co.nim index c6cfe414..7e44e6fd 100644 --- a/benchmarks-threadpool/matmul_cache_oblivious/threadpool_matmul_co.nim +++ b/benchmarks-threadpool/matmul_cache_oblivious/threadpool_matmul_co.nim @@ -19,7 +19,7 @@ import # Stdlib system/ansi_c, std/[strformat, os, strutils, math, cpuinfo], # Library - ../../constantine/threadpool, + constantine/threadpool, # bench ../wtime, ../resources diff --git a/benchmarks-threadpool/matrix_transposition/threadpool_transposes.nim b/benchmarks-threadpool/matrix_transposition/threadpool_transposes.nim index 4ae19be2..bb1ffc96 100644 --- a/benchmarks-threadpool/matrix_transposition/threadpool_transposes.nim +++ b/benchmarks-threadpool/matrix_transposition/threadpool_transposes.nim @@ -12,7 +12,7 @@ import # Stdlib system/ansi_c, std/[strformat, os, strutils, math, cpuinfo], # Constantine - ../../constantine/threadpool + constantine/threadpool when not defined(windows): # bench @@ -316,4 +316,4 @@ proc main() = wv_free(bufOut) wv_free(bufIn) -main() \ No newline at end of file +main() diff --git a/benchmarks-threadpool/nqueens/threadpool_nqueens.nim b/benchmarks-threadpool/nqueens/threadpool_nqueens.nim index f975872a..cdd493a9 100644 --- a/benchmarks-threadpool/nqueens/threadpool_nqueens.nim +++ b/benchmarks-threadpool/nqueens/threadpool_nqueens.nim @@ -39,7 +39,7 @@ import # Stdlib system/ansi_c, std/[strformat, os, strutils, cpuinfo], # library - ../../constantine/threadpool + constantine/threadpool when not defined(windows): # bench diff --git a/benchmarks-threadpool/single_task_producer/threadpool_spc.nim b/benchmarks-threadpool/single_task_producer/threadpool_spc.nim index 902088fb..f42dfe22 100644 --- a/benchmarks-threadpool/single_task_producer/threadpool_spc.nim +++ b/benchmarks-threadpool/single_task_producer/threadpool_spc.nim @@ -2,7 +2,7 @@ import # STD lib system/ansi_c, std/[os, strutils, cpuinfo, strformat, math], # Library - ../../constantine/threadpool, + constantine/threadpool, # bench ../wtime, ../resources diff --git a/benchmarks/bench_blueprint.nim b/benchmarks/bench_blueprint.nim index a3a4bd5a..4bfe4dd2 100644 --- a/benchmarks/bench_blueprint.nim +++ b/benchmarks/bench_blueprint.nim @@ -14,9 +14,9 @@ import # Internal - ../constantine/platforms/abstractions, + constantine/platforms/abstractions, # Helpers - ../helpers/prng_unsafe, + helpers/prng_unsafe, ./platforms, # Standard library std/[monotimes, times, strformat, strutils, macros] diff --git a/benchmarks/bench_ec_g1.nim b/benchmarks/bench_ec_g1.nim index d6cd9249..c3fb85ad 100644 --- a/benchmarks/bench_ec_g1.nim +++ b/benchmarks/bench_ec_g1.nim @@ -8,9 +8,9 @@ import # Internals - ../constantine/math/config/curves, - ../constantine/math/arithmetic, - ../constantine/math/elliptic/[ + constantine/named/algebra, + constantine/math/arithmetic, + constantine/math/elliptic/[ ec_shortweierstrass_projective, ec_shortweierstrass_jacobian, ec_shortweierstrass_jacobian_extended], diff --git a/benchmarks/bench_ec_g1_batch.nim b/benchmarks/bench_ec_g1_batch.nim index 15ae82ac..f9b29241 100644 --- a/benchmarks/bench_ec_g1_batch.nim +++ b/benchmarks/bench_ec_g1_batch.nim @@ -8,9 +8,9 @@ import # Internals - ../constantine/math/config/curves, - ../constantine/math/arithmetic, - ../constantine/math/elliptic/[ + constantine/named/algebra, + constantine/math/arithmetic, + constantine/math/elliptic/[ ec_shortweierstrass_projective, ec_shortweierstrass_jacobian, ec_shortweierstrass_jacobian_extended], diff --git a/benchmarks/bench_ec_g1_scalar_mul.nim b/benchmarks/bench_ec_g1_scalar_mul.nim index 8560333a..a4618bbb 100644 --- a/benchmarks/bench_ec_g1_scalar_mul.nim +++ b/benchmarks/bench_ec_g1_scalar_mul.nim @@ -8,9 +8,9 @@ import # Internals - ../constantine/math/config/curves, - ../constantine/math/arithmetic, - ../constantine/math/elliptic/[ + constantine/named/algebra, + constantine/math/arithmetic, + constantine/math/elliptic/[ ec_shortweierstrass_projective, ec_shortweierstrass_jacobian], # Helpers diff --git a/benchmarks/bench_ec_g2.nim b/benchmarks/bench_ec_g2.nim index debc0606..9e39fdc4 100644 --- a/benchmarks/bench_ec_g2.nim +++ b/benchmarks/bench_ec_g2.nim @@ -8,10 +8,10 @@ import # Internals - ../constantine/math/config/curves, - ../constantine/math/arithmetic, - ../constantine/math/extension_fields, - ../constantine/math/elliptic/[ + constantine/named/algebra, + constantine/math/arithmetic, + constantine/math/extension_fields, + constantine/math/elliptic/[ ec_shortweierstrass_projective, ec_shortweierstrass_jacobian, ec_shortweierstrass_jacobian_extended], diff --git a/benchmarks/bench_ec_g2_scalar_mul.nim b/benchmarks/bench_ec_g2_scalar_mul.nim index 63bb71a9..a9dce05d 100644 --- a/benchmarks/bench_ec_g2_scalar_mul.nim +++ b/benchmarks/bench_ec_g2_scalar_mul.nim @@ -8,10 +8,10 @@ import # Internals - ../constantine/math/config/curves, - ../constantine/math/arithmetic, - ../constantine/math/extension_fields, - ../constantine/math/elliptic/[ + constantine/named/algebra, + constantine/math/arithmetic, + constantine/math/extension_fields, + constantine/math/elliptic/[ ec_shortweierstrass_projective, ec_shortweierstrass_jacobian], # Helpers diff --git a/benchmarks/bench_ec_msm_bandersnatch.nim b/benchmarks/bench_ec_msm_bandersnatch.nim index b0095b39..55c9aea7 100644 --- a/benchmarks/bench_ec_msm_bandersnatch.nim +++ b/benchmarks/bench_ec_msm_bandersnatch.nim @@ -8,11 +8,11 @@ import # Internals - ../constantine/math/config/curves, - ../constantine/math/arithmetic, - ../constantine/math/elliptic/ec_twistededwards_projective, + constantine/named/algebra, + constantine/math/arithmetic, + constantine/math/elliptic/ec_twistededwards_projective, # Helpers - ../helpers/prng_unsafe, + helpers/prng_unsafe, ./bench_elliptic_parallel_template # ############################################################ diff --git a/benchmarks/bench_ec_msm_bls12_381_g1.nim b/benchmarks/bench_ec_msm_bls12_381_g1.nim index b688fcba..e71aa54f 100644 --- a/benchmarks/bench_ec_msm_bls12_381_g1.nim +++ b/benchmarks/bench_ec_msm_bls12_381_g1.nim @@ -8,13 +8,13 @@ import # Internals - ../constantine/math/config/curves, - ../constantine/math/arithmetic, - ../constantine/math/elliptic/[ + constantine/named/algebra, + constantine/math/arithmetic, + constantine/math/elliptic/[ ec_shortweierstrass_projective, ec_shortweierstrass_jacobian], # Helpers - ../helpers/prng_unsafe, + helpers/prng_unsafe, ./bench_elliptic_parallel_template # ############################################################ diff --git a/benchmarks/bench_ec_msm_bls12_381_g2.nim b/benchmarks/bench_ec_msm_bls12_381_g2.nim index 488374c8..12c89a88 100644 --- a/benchmarks/bench_ec_msm_bls12_381_g2.nim +++ b/benchmarks/bench_ec_msm_bls12_381_g2.nim @@ -8,13 +8,13 @@ import # Internals - ../constantine/math/config/curves, - ../constantine/math/extension_fields, - ../constantine/math/elliptic/[ + constantine/named/algebra, + constantine/math/extension_fields, + constantine/math/elliptic/[ ec_shortweierstrass_projective, ec_shortweierstrass_jacobian], # Helpers - ../helpers/prng_unsafe, + helpers/prng_unsafe, ./bench_elliptic_parallel_template # ############################################################ diff --git a/benchmarks/bench_ec_msm_bn254_snarks_g1.nim b/benchmarks/bench_ec_msm_bn254_snarks_g1.nim index cb935660..a20bb3fe 100644 --- a/benchmarks/bench_ec_msm_bn254_snarks_g1.nim +++ b/benchmarks/bench_ec_msm_bn254_snarks_g1.nim @@ -8,9 +8,9 @@ import # Internals - ../constantine/math/config/curves, - ../constantine/math/arithmetic, - ../constantine/math/elliptic/[ + constantine/named/algebra, + constantine/math/arithmetic, + constantine/math/elliptic/[ ec_shortweierstrass_projective, ec_shortweierstrass_jacobian], # Helpers diff --git a/benchmarks/bench_ec_msm_pasta.nim b/benchmarks/bench_ec_msm_pasta.nim index 220bdc1b..ff3a5fad 100644 --- a/benchmarks/bench_ec_msm_pasta.nim +++ b/benchmarks/bench_ec_msm_pasta.nim @@ -8,13 +8,13 @@ import # Internals - ../constantine/math/config/curves, - ../constantine/math/arithmetic, - ../constantine/math/elliptic/[ + constantine/named/algebra, + constantine/math/arithmetic, + constantine/math/elliptic/[ ec_shortweierstrass_projective, ec_shortweierstrass_jacobian], # Helpers - ../helpers/prng_unsafe, + helpers/prng_unsafe, ./bench_elliptic_parallel_template # ############################################################ diff --git a/benchmarks/bench_elliptic_parallel_template.nim b/benchmarks/bench_elliptic_parallel_template.nim index 0b7b3734..346cb3b4 100644 --- a/benchmarks/bench_elliptic_parallel_template.nim +++ b/benchmarks/bench_elliptic_parallel_template.nim @@ -8,9 +8,9 @@ import # Internals - ../constantine/math/config/curves, - ../constantine/math/arithmetic, - ../constantine/math/elliptic/[ + constantine/named/algebra, + constantine/math/arithmetic, + constantine/math/elliptic/[ ec_shortweierstrass_affine, ec_shortweierstrass_projective, ec_shortweierstrass_jacobian, @@ -19,11 +19,11 @@ import ec_multi_scalar_mul, ec_scalar_mul, ec_scalar_mul_vartime, ec_multi_scalar_mul_parallel], - ../constantine/math/constants/zoo_subgroups, + constantine/named/zoo_subgroups, # Threadpool - ../constantine/threadpool/[threadpool, partitioners], + constantine/threadpool/[threadpool, partitioners], # Helpers - ../helpers/prng_unsafe, + helpers/prng_unsafe, ./bench_elliptic_template, ./bench_blueprint diff --git a/benchmarks/bench_elliptic_template.nim b/benchmarks/bench_elliptic_template.nim index 34879728..7b028774 100644 --- a/benchmarks/bench_elliptic_template.nim +++ b/benchmarks/bench_elliptic_template.nim @@ -14,24 +14,24 @@ import # Internals - ../constantine/platforms/abstractions, - ../constantine/math/config/curves, - ../constantine/math/arithmetic, - ../constantine/math/io/io_bigints, - ../constantine/math/elliptic/[ + constantine/platforms/abstractions, + constantine/named/algebra, + constantine/math/arithmetic, + constantine/math/io/io_bigints, + constantine/math/elliptic/[ ec_shortweierstrass_affine, ec_shortweierstrass_projective, ec_shortweierstrass_jacobian, ec_shortweierstrass_jacobian_extended, ec_shortweierstrass_batch_ops, ec_scalar_mul, ec_endomorphism_accel], - ../constantine/math/constants/zoo_subgroups, + constantine/named/zoo_subgroups, # Helpers - ../helpers/prng_unsafe, + helpers/prng_unsafe, ./platforms, ./bench_blueprint, # Reference unsafe scalar multiplication - ../constantine/math/elliptic/ec_scalar_mul_vartime + constantine/math/elliptic/ec_scalar_mul_vartime export notes export abstractions # generic sandwich on SecretBool and SecretBool in Jacobian sum diff --git a/benchmarks/bench_eth_bls_signatures.nim b/benchmarks/bench_eth_bls_signatures.nim index 2eb5397d..e414ee07 100644 --- a/benchmarks/bench_eth_bls_signatures.nim +++ b/benchmarks/bench_eth_bls_signatures.nim @@ -8,15 +8,15 @@ import # Internals - ../constantine/[ + constantine/[ ethereum_bls_signatures_parallel, ethereum_eip2333_bls12381_key_derivation], - ../constantine/math/arithmetic, - ../constantine/threadpool/threadpool, + constantine/math/arithmetic, + constantine/threadpool/threadpool, # Std std/[os, cpuinfo], # Helpers - ../helpers/prng_unsafe, + helpers/prng_unsafe, ./bench_blueprint proc separator*() = separator(180) diff --git a/benchmarks/bench_eth_eip2537_subgroup_checks_impact.nim b/benchmarks/bench_eth_eip2537_subgroup_checks_impact.nim index a3e7fad6..ad7205c5 100644 --- a/benchmarks/bench_eth_eip2537_subgroup_checks_impact.nim +++ b/benchmarks/bench_eth_eip2537_subgroup_checks_impact.nim @@ -8,10 +8,10 @@ import # Internals - ../constantine/math/config/curves, - ../constantine/math/arithmetic, - ../constantine/math/extension_fields, - ../constantine/math/elliptic/ec_shortweierstrass_jacobian, + constantine/named/algebra, + constantine/math/arithmetic, + constantine/math/extension_fields, + constantine/math/elliptic/ec_shortweierstrass_jacobian, # Helpers ./bench_elliptic_template diff --git a/benchmarks/bench_eth_eip4844_kzg.nim b/benchmarks/bench_eth_eip4844_kzg.nim index c54c5c56..900e6299 100644 --- a/benchmarks/bench_eth_eip4844_kzg.nim +++ b/benchmarks/bench_eth_eip4844_kzg.nim @@ -8,14 +8,14 @@ import # Internals - ../constantine/ethereum_eip4844_kzg_parallel, - ../constantine/math/io/io_fields, - ../constantine/math/config/[curves, type_ff], - ../constantine/threadpool/threadpool, - ../constantine/csprngs/sysrand, - ../constantine/platforms/primitives, + constantine/ethereum_eip4844_kzg_parallel, + constantine/named/algebra, + constantine/math/io/io_fields, + constantine/threadpool/threadpool, + constantine/csprngs/sysrand, + constantine/platforms/primitives, # Helpers - ../helpers/prng_unsafe, + helpers/prng_unsafe, ./bench_blueprint, # Standard library std/[os, strutils] diff --git a/benchmarks/bench_eth_evm_modexp_dos.nim b/benchmarks/bench_eth_evm_modexp_dos.nim index b174faa7..2ef84c63 100644 --- a/benchmarks/bench_eth_evm_modexp_dos.nim +++ b/benchmarks/bench_eth_evm_modexp_dos.nim @@ -1,8 +1,8 @@ import - ../constantine/ethereum_evm_precompiles, - ../constantine/math/arithmetic, - ../constantine/math/io/io_bigints, - ../constantine/platforms/abstractions, + constantine/ethereum_evm_precompiles, + constantine/math/arithmetic, + constantine/math/io/io_bigints, + constantine/platforms/abstractions, ./bench_blueprint proc report(op: string, elapsedNs: int64, elapsedCycles: int64, iters: int) = @@ -434,4 +434,4 @@ dos2b() echo "\n" dos2c() echo "\n" -dos2d() \ No newline at end of file +dos2d() diff --git a/benchmarks/bench_eth_evm_precompiles.nim b/benchmarks/bench_eth_evm_precompiles.nim index 86c75412..17645bf1 100644 --- a/benchmarks/bench_eth_evm_precompiles.nim +++ b/benchmarks/bench_eth_evm_precompiles.nim @@ -8,17 +8,17 @@ import # Internals - ../constantine/ethereum_evm_precompiles, - ../constantine/serialization/codecs, - ../constantine/math/config/curves, - ../constantine/math/[arithmetic, ec_shortweierstrass, extension_fields], - ../constantine/math/io/[io_bigints, io_fields], - ../constantine/math/constants/zoo_subgroups, + constantine/ethereum_evm_precompiles, + constantine/serialization/codecs, + constantine/named/algebra, + constantine/math/[arithmetic, ec_shortweierstrass, extension_fields], + constantine/math/io/[io_bigints, io_fields], + constantine/named/zoo_subgroups, # Stdlib std/tables, # Helpers ./bench_blueprint, - ../helpers/prng_unsafe + helpers/prng_unsafe # For EIP-2537, we use the worst case vectors: # https://eips.ethereum.org/assets/eip-2537/bench_vectors diff --git a/benchmarks/bench_fields_template.nim b/benchmarks/bench_fields_template.nim index 23133a88..bb77a586 100644 --- a/benchmarks/bench_fields_template.nim +++ b/benchmarks/bench_fields_template.nim @@ -14,13 +14,13 @@ import # Internals - ../constantine/platforms/abstractions, - ../constantine/math/config/curves, - ../constantine/math/arithmetic, - ../constantine/math/extension_fields, - ../constantine/math/constants/zoo_square_roots, + constantine/platforms/abstractions, + constantine/named/algebra, + constantine/math/arithmetic, + constantine/math/extension_fields, + constantine/named/zoo_square_roots, # Helpers - ../helpers/prng_unsafe, + helpers/prng_unsafe, ./bench_blueprint export notes, abstractions diff --git a/benchmarks/bench_fp.nim b/benchmarks/bench_fp.nim index 4289c759..fe58ed38 100644 --- a/benchmarks/bench_fp.nim +++ b/benchmarks/bench_fp.nim @@ -8,10 +8,10 @@ import # Internals - ../constantine/math/config/curves, - ../constantine/math/arithmetic, - ../constantine/math/io/io_bigints, - ../constantine/math/constants/zoo_square_roots, + constantine/named/algebra, + constantine/math/arithmetic, + constantine/math/io/io_bigints, + constantine/named/zoo_square_roots, # Helpers ./bench_fields_template diff --git a/benchmarks/bench_fp12.nim b/benchmarks/bench_fp12.nim index 344262c0..73641a1c 100644 --- a/benchmarks/bench_fp12.nim +++ b/benchmarks/bench_fp12.nim @@ -8,8 +8,8 @@ import # Internals - ../constantine/math/config/curves, - ../constantine/math/extension_fields, + constantine/named/algebra, + constantine/math/extension_fields, # Helpers ./bench_fields_template diff --git a/benchmarks/bench_fp2.nim b/benchmarks/bench_fp2.nim index b3b83963..97b18c9b 100644 --- a/benchmarks/bench_fp2.nim +++ b/benchmarks/bench_fp2.nim @@ -8,8 +8,8 @@ import # Internals - ../constantine/math/config/curves, - ../constantine/math/extension_fields, + constantine/named/algebra, + constantine/math/extension_fields, # Helpers ./bench_fields_template diff --git a/benchmarks/bench_fp4.nim b/benchmarks/bench_fp4.nim index c2f7ac84..0dbf8664 100644 --- a/benchmarks/bench_fp4.nim +++ b/benchmarks/bench_fp4.nim @@ -8,8 +8,8 @@ import # Internals - ../constantine/math/config/curves, - ../constantine/math/extension_fields, + constantine/named/algebra, + constantine/math/extension_fields, # Helpers ./bench_fields_template diff --git a/benchmarks/bench_fp6.nim b/benchmarks/bench_fp6.nim index 8827179c..cba79ae8 100644 --- a/benchmarks/bench_fp6.nim +++ b/benchmarks/bench_fp6.nim @@ -8,8 +8,8 @@ import # Internals - ../constantine/math/config/curves, - ../constantine/math/extension_fields, + constantine/named/algebra, + constantine/math/extension_fields, # Helpers ./bench_fields_template diff --git a/benchmarks/bench_fp_double_precision.nim b/benchmarks/bench_fp_double_precision.nim index e6ae67c5..3d2195aa 100644 --- a/benchmarks/bench_fp_double_precision.nim +++ b/benchmarks/bench_fp_double_precision.nim @@ -14,12 +14,12 @@ import # Internals - ../constantine/platforms/abstractions, - ../constantine/math/config/curves, - ../constantine/math/arithmetic, - ../constantine/math/extension_fields, + constantine/platforms/abstractions, + constantine/named/algebra, + constantine/math/arithmetic, + constantine/math/extension_fields, # Helpers - ../helpers/prng_unsafe, + helpers/prng_unsafe, ./platforms, # Standard library std/[monotimes, times, strformat, strutils] diff --git a/benchmarks/bench_gmp_modexp.nim b/benchmarks/bench_gmp_modexp.nim index 880ebcd5..267344ff 100644 --- a/benchmarks/bench_gmp_modexp.nim +++ b/benchmarks/bench_gmp_modexp.nim @@ -1,11 +1,10 @@ import - ../constantine/math/arithmetic, - ../constantine/math/io/[io_bigints, io_fields], - ../constantine/math_arbitrary_precision/arithmetic/[bigints_views, limbs_views, limbs_montgomery, limbs_mod2k], - ../constantine/math/config/[type_bigint, curves, precompute], - ../constantine/platforms/abstractions, - ../constantine/serialization/codecs, - ../helpers/prng_unsafe, + constantine/math/arithmetic, + constantine/math/io/io_bigints, + constantine/math_arbitrary_precision/arithmetic/bigints_views, + constantine/platforms/abstractions, + constantine/serialization/codecs, + helpers/prng_unsafe, std/[times, monotimes, strformat] import gmp @@ -110,4 +109,4 @@ for i in 0 ..< 5: # echo &"\n ratio Stint/Constantine: {float64(elapsedStint)/float64(elapsedCtt):.3f}x" echo &" ratio GMP/Constantine: {float64(elapsedGMP)/float64(elapsedCtt):.3f}x" - echo "---------------------------------------------------------" \ No newline at end of file + echo "---------------------------------------------------------" diff --git a/benchmarks/bench_gmp_modmul.nim b/benchmarks/bench_gmp_modmul.nim index 73e61665..46306ac0 100644 --- a/benchmarks/bench_gmp_modmul.nim +++ b/benchmarks/bench_gmp_modmul.nim @@ -12,13 +12,13 @@ import # Third-party gmp, # Internal - ../constantine/math/io/io_bigints, - ../constantine/math/arithmetic, - ../constantine/math_arbitrary_precision/arithmetic/limbs_divmod_vartime, - ../constantine/platforms/abstractions, - ../constantine/serialization/codecs, + constantine/math/io/io_bigints, + constantine/math/arithmetic, + constantine/math_arbitrary_precision/arithmetic/limbs_divmod_vartime, + constantine/platforms/abstractions, + constantine/serialization/codecs, # Test utilities - ../helpers/prng_unsafe + helpers/prng_unsafe echo "\n------------------------------------------------------\n" # We test up to 1024-bit, more is really slow diff --git a/benchmarks/bench_hash_to_curve.nim b/benchmarks/bench_hash_to_curve.nim index 37db7ca4..7edceb81 100644 --- a/benchmarks/bench_hash_to_curve.nim +++ b/benchmarks/bench_hash_to_curve.nim @@ -8,15 +8,15 @@ import # Internals - ../constantine/platforms/abstractions, - ../constantine/math/config/curves, - ../constantine/math/extension_fields, - ../constantine/math/io/[io_bigints, io_ec], - ../constantine/math/ec_shortweierstrass, - ../constantine/hash_to_curve/hash_to_curve, - ../constantine/hashes, + constantine/platforms/abstractions, + constantine/named/algebra, + constantine/math/extension_fields, + constantine/math/io/[io_bigints, io_ec], + constantine/math/ec_shortweierstrass, + constantine/hash_to_curve/hash_to_curve, + constantine/hashes, # Helpers - ../helpers/prng_unsafe, + helpers/prng_unsafe, ./bench_blueprint proc separator*() = separator(132) diff --git a/benchmarks/bench_pairing_bls12_377.nim b/benchmarks/bench_pairing_bls12_377.nim index 7bc205ab..2c3d81f9 100644 --- a/benchmarks/bench_pairing_bls12_377.nim +++ b/benchmarks/bench_pairing_bls12_377.nim @@ -8,9 +8,9 @@ import # Internals - ../constantine/math/config/curves, - ../constantine/math/arithmetic, - ../constantine/math/extension_fields, + constantine/named/algebra, + constantine/math/arithmetic, + constantine/math/extension_fields, # Helpers ./bench_pairing_template diff --git a/benchmarks/bench_pairing_bls12_381.nim b/benchmarks/bench_pairing_bls12_381.nim index bf9270a4..2b08dae8 100644 --- a/benchmarks/bench_pairing_bls12_381.nim +++ b/benchmarks/bench_pairing_bls12_381.nim @@ -8,9 +8,9 @@ import # Internals - ../constantine/math/config/curves, - ../constantine/math/arithmetic, - ../constantine/math/extension_fields, + constantine/named/algebra, + constantine/math/arithmetic, + constantine/math/extension_fields, # Helpers ./bench_pairing_template diff --git a/benchmarks/bench_pairing_bn254_nogami.nim b/benchmarks/bench_pairing_bn254_nogami.nim index 899f9fa9..fd94de9e 100644 --- a/benchmarks/bench_pairing_bn254_nogami.nim +++ b/benchmarks/bench_pairing_bn254_nogami.nim @@ -8,9 +8,9 @@ import # Internals - ../constantine/math/config/curves, - ../constantine/math/arithmetic, - ../constantine/math/extension_fields, + constantine/named/algebra, + constantine/math/arithmetic, + constantine/math/extension_fields, # Helpers ./bench_pairing_template diff --git a/benchmarks/bench_pairing_bn254_snarks.nim b/benchmarks/bench_pairing_bn254_snarks.nim index ebd71afc..a492ac96 100644 --- a/benchmarks/bench_pairing_bn254_snarks.nim +++ b/benchmarks/bench_pairing_bn254_snarks.nim @@ -8,9 +8,9 @@ import # Internals - ../constantine/math/config/curves, - ../constantine/math/arithmetic, - ../constantine/math/extension_fields, + constantine/named/algebra, + constantine/math/arithmetic, + constantine/math/extension_fields, # Helpers ./bench_pairing_template diff --git a/benchmarks/bench_pairing_template.nim b/benchmarks/bench_pairing_template.nim index 2ebd19a0..f30bc1d1 100644 --- a/benchmarks/bench_pairing_template.nim +++ b/benchmarks/bench_pairing_template.nim @@ -14,21 +14,21 @@ import # Internals - ../constantine/platforms/abstractions, - ../constantine/math/config/curves, - ../constantine/math/arithmetic, - ../constantine/math/extension_fields, - ../constantine/math/ec_shortweierstrass, - ../constantine/math/constants/zoo_subgroups, - ../constantine/math/pairings/[ + constantine/platforms/abstractions, + constantine/named/algebra, + constantine/math/arithmetic, + constantine/math/extension_fields, + constantine/math/ec_shortweierstrass, + constantine/named/zoo_subgroups, + constantine/math/pairings/[ cyclotomic_subgroups, lines_eval, pairings_bls12, pairings_bn ], - ../constantine/math/constants/zoo_pairings, + constantine/named/zoo_pairings, # Helpers - ../helpers/prng_unsafe, + helpers/prng_unsafe, ./bench_blueprint export abstractions diff --git a/benchmarks/bench_poly1305.nim b/benchmarks/bench_poly1305.nim index cef3d6c9..9268a1c3 100644 --- a/benchmarks/bench_poly1305.nim +++ b/benchmarks/bench_poly1305.nim @@ -1,8 +1,8 @@ import # Internals - ../constantine/mac/mac_poly1305, + constantine/mac/mac_poly1305, # Helpers - ../helpers/prng_unsafe, + helpers/prng_unsafe, ./bench_blueprint proc separator*() = separator(69) diff --git a/benchmarks/bench_powmod.nim b/benchmarks/bench_powmod.nim index fa7e0844..524d5aa6 100644 --- a/benchmarks/bench_powmod.nim +++ b/benchmarks/bench_powmod.nim @@ -1,11 +1,11 @@ import - ../constantine/math/arithmetic, - ../constantine/math/io/[io_bigints, io_fields], - ../constantine/math/config/curves, - ../constantine/platforms/abstractions, - ../constantine/serialization/codecs, - ../constantine/math_arbitrary_precision/arithmetic/bigints_views, - ../helpers/prng_unsafe, + constantine/math/arithmetic, + constantine/math/io/[io_bigints, io_fields], + constantine/named/algebra, + constantine/platforms/abstractions, + constantine/serialization/codecs, + constantine/math_arbitrary_precision/arithmetic/bigints_views, + helpers/prng_unsafe, ./platforms, ./bench_blueprint import stint, gmp @@ -203,4 +203,4 @@ proc benchAll(desc: seq[BenchDesc]) = when isMainModule: let benchDesc = genBench(100) - benchDesc.benchAll() \ No newline at end of file + benchDesc.benchAll() diff --git a/benchmarks/bench_sha256.nim b/benchmarks/bench_sha256.nim index 511a67a0..c912bf8c 100644 --- a/benchmarks/bench_sha256.nim +++ b/benchmarks/bench_sha256.nim @@ -1,8 +1,8 @@ import # Internals - ../constantine/hashes, + constantine/hashes, # Helpers - ../helpers/prng_unsafe, + helpers/prng_unsafe, ./bench_blueprint proc separator*() = separator(69) diff --git a/benchmarks/bench_summary_bls12_377.nim b/benchmarks/bench_summary_bls12_377.nim index ee11b7cb..0e1d7ce0 100644 --- a/benchmarks/bench_summary_bls12_377.nim +++ b/benchmarks/bench_summary_bls12_377.nim @@ -8,9 +8,9 @@ import # Internals - ../constantine/math/config/curves, - ../constantine/math/arithmetic, - ../constantine/math/extension_fields, + constantine/named/algebra, + constantine/math/arithmetic, + constantine/math/extension_fields, # Helpers ./bench_summary_template diff --git a/benchmarks/bench_summary_bls12_381.nim b/benchmarks/bench_summary_bls12_381.nim index f49c40bb..e944025b 100644 --- a/benchmarks/bench_summary_bls12_381.nim +++ b/benchmarks/bench_summary_bls12_381.nim @@ -8,9 +8,9 @@ import # Internals - ../constantine/math/config/curves, - ../constantine/math/arithmetic, - ../constantine/math/extension_fields, + constantine/named/algebra, + constantine/math/arithmetic, + constantine/math/extension_fields, # Helpers ./bench_summary_template diff --git a/benchmarks/bench_summary_bn254_nogami.nim b/benchmarks/bench_summary_bn254_nogami.nim index c9aae933..10f362c3 100644 --- a/benchmarks/bench_summary_bn254_nogami.nim +++ b/benchmarks/bench_summary_bn254_nogami.nim @@ -8,9 +8,9 @@ import # Internals - ../constantine/math/config/curves, - ../constantine/math/arithmetic, - ../constantine/math/extension_fields, + constantine/named/algebra, + constantine/math/arithmetic, + constantine/math/extension_fields, # Helpers ./bench_summary_template diff --git a/benchmarks/bench_summary_bn254_snarks.nim b/benchmarks/bench_summary_bn254_snarks.nim index a6c15a3e..cb3832f9 100644 --- a/benchmarks/bench_summary_bn254_snarks.nim +++ b/benchmarks/bench_summary_bn254_snarks.nim @@ -8,9 +8,9 @@ import # Internals - ../constantine/math/config/curves, - ../constantine/math/arithmetic, - ../constantine/math/extension_fields, + constantine/named/algebra, + constantine/math/arithmetic, + constantine/math/extension_fields, # Helpers ./bench_summary_template diff --git a/benchmarks/bench_summary_pasta.nim b/benchmarks/bench_summary_pasta.nim index 2b1de578..fab5a23d 100644 --- a/benchmarks/bench_summary_pasta.nim +++ b/benchmarks/bench_summary_pasta.nim @@ -8,9 +8,9 @@ import # Internals - ../constantine/math/config/curves, - ../constantine/math/arithmetic, - ../constantine/math/extension_fields, + constantine/named/algebra, + constantine/math/arithmetic, + constantine/math/extension_fields, # Helpers ./bench_summary_template diff --git a/benchmarks/bench_summary_template.nim b/benchmarks/bench_summary_template.nim index 4f3551ca..36b32b4c 100644 --- a/benchmarks/bench_summary_template.nim +++ b/benchmarks/bench_summary_template.nim @@ -14,25 +14,25 @@ import # Internals - ../constantine/platforms/abstractions, - ../constantine/math/config/curves, - ../constantine/math/[arithmetic, extension_fields], - ../constantine/math/elliptic/[ + constantine/platforms/abstractions, + constantine/named/algebra, + constantine/math/[arithmetic, extension_fields], + constantine/math/elliptic/[ ec_shortweierstrass_affine, ec_shortweierstrass_projective, ec_shortweierstrass_jacobian, ec_scalar_mul, ec_scalar_mul_vartime, ec_endomorphism_accel], - ../constantine/math/constants/zoo_subgroups, - ../constantine/math/pairings/[ + constantine/named/zoo_subgroups, + constantine/math/pairings/[ cyclotomic_subgroups, pairings_bls12, pairings_bn ], - ../constantine/math/constants/zoo_pairings, - ../constantine/hashes, - ../constantine/hash_to_curve/hash_to_curve, + constantine/named/zoo_pairings, + constantine/hashes, + constantine/hash_to_curve/hash_to_curve, # Helpers - ../helpers/prng_unsafe, + helpers/prng_unsafe, ./bench_blueprint export @@ -296,4 +296,4 @@ proc subgroupCheckBench*(EC: typedesc, iters: int) = P.clearCofactor() bench("Subgroup check", EC, iters): - discard P.isInSubgroup() \ No newline at end of file + discard P.isInSubgroup() diff --git a/benchmarks/bench_verkle_primitives.nim b/benchmarks/bench_verkle_primitives.nim index c8ce97fa..fba3bc40 100644 --- a/benchmarks/bench_verkle_primitives.nim +++ b/benchmarks/bench_verkle_primitives.nim @@ -14,14 +14,14 @@ import # Internals - ../constantine/platforms/abstractions, - ../constantine/math/config/curves, - ../constantine/math/[arithmetic, extension_fields], - ../constantine/math/ec_twistededwards, - ../constantine/math/constants/zoo_generators, - ../constantine/math/io/io_fields, - ../constantine/hash_to_curve/hash_to_curve, - ../constantine/serialization/codecs_banderwagon, + constantine/platforms/abstractions, + constantine/named/algebra, + constantine/math/[arithmetic, extension_fields], + constantine/math/ec_twistededwards, + constantine/named/zoo_generators, + constantine/math/io/io_fields, + constantine/hash_to_curve/hash_to_curve, + constantine/serialization/codecs_banderwagon, # Helpers ./bench_blueprint diff --git a/benchmarks/platforms.nim b/benchmarks/platforms.nim index c057e17e..fe263298 100644 --- a/benchmarks/platforms.nim +++ b/benchmarks/platforms.nim @@ -6,5 +6,5 @@ # * Apache v2 license (license terms in the root directory or at http://www.apache.org/licenses/LICENSE-2.0). # at your option. This file may not be copied, modified, or distributed except according to those terms. -import ../constantine/platforms/metering/benchmarking -export benchmarking \ No newline at end of file +import constantine/platforms/metering/benchmarking +export benchmarking diff --git a/bindings/c_curve_decls.nim b/bindings/c_curve_decls.nim index c7479f07..c015b9d7 100644 --- a/bindings/c_curve_decls.nim +++ b/bindings/c_curve_decls.nim @@ -7,12 +7,12 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../constantine/math/config/curves, - ../constantine/curves_primitives, + constantine/named/algebra, + constantine/curves_primitives, - ../constantine/math/extension_fields # generic sandwich + constantine/math/extension_fields # generic sandwich -export curves, curves_primitives, extension_fields +export algebra, curves_primitives, extension_fields # Overview # ------------------------------------------------------------ diff --git a/bindings/c_curve_decls_parallel.nim b/bindings/c_curve_decls_parallel.nim index 5a4a04cf..65f1ce6b 100644 --- a/bindings/c_curve_decls_parallel.nim +++ b/bindings/c_curve_decls_parallel.nim @@ -7,10 +7,10 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../constantine/math/config/curves, - ../constantine/curves_primitives_parallel, - ../constantine/platforms/allocs, - ../constantine/threadpool + constantine/named/algebra, + constantine/curves_primitives_parallel, + constantine/platforms/allocs, + constantine/threadpool export curves_primitives_parallel diff --git a/bindings/lib_autoload.nim b/bindings/lib_autoload.nim index 1f822d22..08139474 100644 --- a/bindings/lib_autoload.nim +++ b/bindings/lib_autoload.nim @@ -6,16 +6,16 @@ # * Apache v2 license (license terms in the root directory or at http://www.apache.org/licenses/LICENSE-2.0). # at your option. This file may not be copied, modified, or distributed except according to those terms. -import ../constantine/platforms/loadtime_functions +import constantine/platforms/loadtime_functions -# When Constantine is built as a library, we want to minimize friction of using it. +# When Constantine is built as a library, we want to minimize friction of using it. # Hence we want to users to be able to directly use it without special ceremony. # # This is possible for dynamic libraries if --noMain isn't used. # # https://github.com/nim-lang/Nim/blob/v2.0.0/compiler/cgen.nim#L1572-L1583 # https://github.com/nim-lang/Nim/blob/v2.0.0/lib/nimbase.h#L513 -# +# # The function DllMain is autoloaded on Windows # Functions tagged __attribute__((constructor)) are autoloaded on UNIX OSes # @@ -45,4 +45,4 @@ when defined(windows) and (appType == "lib" or appType == "staticlib"): ## This returns an runtime reference to the autoloader ## so that it cannot be optimized away. ## Compare it with "nil" - cast[pointer](ctt_autoload_NimMain) \ No newline at end of file + cast[pointer](ctt_autoload_NimMain) diff --git a/bindings/lib_constantine.nim b/bindings/lib_constantine.nim index 752d6336..87845393 100644 --- a/bindings/lib_constantine.nim +++ b/bindings/lib_constantine.nim @@ -15,18 +15,18 @@ {.push warning[UnusedImport]: off.} import - ../constantine/threadpool, + constantine/threadpool, ./lib_hashes, ./lib_curves, - ../constantine/csprngs, + constantine/csprngs, # Protocols - ../constantine/ethereum_bls_signatures, - ../constantine/ethereum_bls_signatures_parallel, - ../constantine/commitments_setups/ethereum_kzg_srs, - ../constantine/ethereum_eip4844_kzg, - ../constantine/ethereum_eip4844_kzg_parallel, + constantine/ethereum_bls_signatures, + constantine/ethereum_bls_signatures_parallel, + constantine/commitments_setups/ethereum_kzg_srs, + constantine/ethereum_eip4844_kzg, + constantine/ethereum_eip4844_kzg_parallel, - ../constantine/ethereum_evm_precompiles, + constantine/ethereum_evm_precompiles, # Ensure globals like proc from kernel32.dll are populated at library load time ./lib_autoload diff --git a/bindings/lib_hashes.nim b/bindings/lib_hashes.nim index 3a4b0e93..ddc5c281 100644 --- a/bindings/lib_hashes.nim +++ b/bindings/lib_hashes.nim @@ -12,14 +12,14 @@ # # ############################################################ -import ../constantine/zoo_exports +import constantine/zoo_exports # Modify per-module prefix if needed # ---------------------------------------- # static: # prefix_sha256 = prefix_ffi & "sha256_" -import ../constantine/hashes +import constantine/hashes func sha256_hash(digest: var array[32, byte], message: openArray[byte], clearMem: bool) {.libPrefix: "ctt_".} = ## Compute the SHA-256 hash of message @@ -31,4 +31,4 @@ func sha256_hash(digest: var array[32, byte], message: openArray[byte], clearMem # - minimal overhead compared to hashing time # - Can be tail-call optimized into a goto jump instead of call/return # - Can be LTO-optimized - sha256.hash(digest, message, clearMem) \ No newline at end of file + sha256.hash(digest, message, clearMem) diff --git a/bindings/lib_headers.nim b/bindings/lib_headers.nim index 828c73d9..b6dba9c7 100644 --- a/bindings/lib_headers.nim +++ b/bindings/lib_headers.nim @@ -14,7 +14,7 @@ import std/[os, strformat, strutils, intsets] import ./c_typedefs, ./lib_curves -import ../constantine/platforms/static_for +import constantine/platforms/static_for proc writeHeader_classicCurve(filepath: string, curve: string, modBits, orderBits: int, curve_decls: string) = var header = "\n" @@ -163,4 +163,4 @@ when isMainModule: proc main() {.inline.} = writeCurveHeaders("include") writeCurveParallelHeaders("include") - main() \ No newline at end of file + main() diff --git a/config.nims b/config.nims new file mode 100644 index 00000000..efde46d7 --- /dev/null +++ b/config.nims @@ -0,0 +1,2 @@ +# Absolute imports from porject root +--path:"." diff --git a/constantine/commitments/eth_verkle_ipa.nim b/constantine/commitments/eth_verkle_ipa.nim index c75c5146..b54be983 100644 --- a/constantine/commitments/eth_verkle_ipa.nim +++ b/constantine/commitments/eth_verkle_ipa.nim @@ -10,7 +10,7 @@ import ./pedersen_commitments, ./eth_verkle_transcripts, ./protocol_quotient_check, - ../math/config/[curves, type_ff], + constantine/named/algebra, ../math/polynomials/polynomials, ../math/[arithmetic, ec_shortweierstrass, ec_twistededwards], ../math/elliptic/ec_multi_scalar_mul, diff --git a/constantine/commitments/eth_verkle_transcripts.nim b/constantine/commitments/eth_verkle_transcripts.nim index 56a98fd2..d65ca549 100644 --- a/constantine/commitments/eth_verkle_transcripts.nim +++ b/constantine/commitments/eth_verkle_transcripts.nim @@ -10,7 +10,7 @@ import ../hashes, ../serialization/[endians, codecs_banderwagon], ../math/[arithmetic, ec_twistededwards], - ../math/config/curves, + constantine/named/algebra, ../math/io/io_bigints, ../math_arbitrary_precision/arithmetic/limbs_divmod_vartime, ../platforms/primitives diff --git a/constantine/commitments/kzg.nim b/constantine/commitments/kzg.nim index 0766418a..11995692 100644 --- a/constantine/commitments/kzg.nim +++ b/constantine/commitments/kzg.nim @@ -7,11 +7,11 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../math/config/curves, + constantine/named/algebra, ../math/[ec_shortweierstrass, arithmetic, extension_fields], ../math/elliptic/[ec_multi_scalar_mul, ec_shortweierstrass_batch_ops], ../math/pairings/pairings_generic, - ../math/constants/zoo_generators, + ../named/zoo_generators, ../math/polynomials/polynomials, ../platforms/[abstractions, views], ./protocol_quotient_check diff --git a/constantine/commitments/kzg_parallel.nim b/constantine/commitments/kzg_parallel.nim index f04566c3..13e75756 100644 --- a/constantine/commitments/kzg_parallel.nim +++ b/constantine/commitments/kzg_parallel.nim @@ -7,11 +7,11 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../math/config/curves, + constantine/named/algebra, ../math/[ec_shortweierstrass, arithmetic, extension_fields], ../math/elliptic/[ec_multi_scalar_mul_parallel, ec_shortweierstrass_batch_ops], ../math/pairings/pairings_generic, - ../math/constants/zoo_generators, + ../named/zoo_generators, ../math/polynomials/polynomials, ../platforms/[abstractions, views], ../threadpool/threadpool, diff --git a/constantine/commitments_setups/ethereum_kzg_srs.nim b/constantine/commitments_setups/ethereum_kzg_srs.nim index 2c9cbe6f..09483c16 100644 --- a/constantine/commitments_setups/ethereum_kzg_srs.nim +++ b/constantine/commitments_setups/ethereum_kzg_srs.nim @@ -7,7 +7,7 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../math/config/curves, + constantine/named/algebra, ../math/[ec_shortweierstrass, arithmetic, extension_fields], ../platforms/[allocs, bithacks, fileio], ../serialization/[codecs, codecs_status_codes, codecs_bls12_381], diff --git a/constantine/curves_primitives.nim b/constantine/curves_primitives.nim index b1e929b9..d95eb638 100644 --- a/constantine/curves_primitives.nim +++ b/constantine/curves_primitives.nim @@ -8,26 +8,21 @@ import ./platforms/abstractions, - ./math/config/[curves, type_ff], + ./named/algebra, + ./named/[zoo_subgroups, zoo_generators, zoo_pairings], ./math/[ ec_shortweierstrass, extension_fields, - arithmetic, - constants/zoo_subgroups, - constants/zoo_generators - ], + arithmetic], ./math/elliptic/[ ec_scalar_mul_vartime, - ec_multi_scalar_mul - ], + ec_multi_scalar_mul], ./math/io/[io_bigints, io_fields], ./math/isogenies/frobenius, ./math/pairings/[ cyclotomic_subgroups, lines_eval, - pairings_generic - ], - ./math/constants/zoo_pairings, + pairings_generic], ./hash_to_curve/hash_to_curve # ############################################################ @@ -44,7 +39,7 @@ import export abstractions, - curves.Curve + algebra.Curve # BigInt # ------------------------------------------------------------ @@ -63,9 +58,9 @@ func marshalBE*(dst: var openarray[byte], src: BigInt): bool = # ------------------------------------------------------------ export - type_ff.Fp, - type_ff.Fr, - type_ff.FF + algebra.Fp, + algebra.Fr, + algebra.FF func unmarshalBE*(dst: var FF, src: openarray[byte]): bool = ## Return true on success diff --git a/constantine/curves_primitives_parallel.nim b/constantine/curves_primitives_parallel.nim index 8a3729c7..7f0cddf8 100644 --- a/constantine/curves_primitives_parallel.nim +++ b/constantine/curves_primitives_parallel.nim @@ -7,7 +7,8 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ./math/config/[curves, type_bigint, type_ff], + ./named/algebra, + ./platforms/abstractions, ./threadpool, ./math/elliptic/ec_multi_scalar_mul_parallel, ./math/ec_shortweierstrass @@ -28,12 +29,12 @@ export threadpool.shutdown # Base types # ------------------------------------------------------------ -export curves.Curve -export type_bigint.BigInt +export algebra.Curve +export abstractions.BigInt export - type_ff.Fp, - type_ff.Fr, - type_ff.FF + algebra.Fp, + algebra.Fr, + algebra.FF # Elliptic curve # ------------------------------------------------------------ @@ -46,4 +47,4 @@ export ec_shortweierstrass.ECP_ShortW export - ec_multi_scalar_mul_parallel.multiScalarMul_vartime_parallel \ No newline at end of file + ec_multi_scalar_mul_parallel.multiScalarMul_vartime_parallel diff --git a/constantine/ethereum_bls_signatures.nim b/constantine/ethereum_bls_signatures.nim index f4f5e2e2..fe5e410b 100644 --- a/constantine/ethereum_bls_signatures.nim +++ b/constantine/ethereum_bls_signatures.nim @@ -59,21 +59,21 @@ export hashes # generic sandwich on sha256 import ./platforms/[abstractions, views, allocs], - ./math/config/curves, + ./named/algebra, + ./named/zoo_subgroups, ./math/[ ec_shortweierstrass, extension_fields, arithmetic, - constants/zoo_subgroups ], ./math/io/[io_bigints, io_fields], - signatures/bls_signatures, - serialization/codecs_status_codes, - serialization/codecs_bls12_381 + ./signatures/bls_signatures, + ./serialization/codecs_status_codes, + ./serialization/codecs_bls12_381 export abstractions, # generic sandwich on SecretBool and SecretBool in Jacobian sumImpl - curves, # generic sandwich on matchingBigInt + algebra, # generic sandwich on matchingBigInt extension_fields, # generic sandwich on extension field access ec_shortweierstrass, # generic sandwich on affine diff --git a/constantine/ethereum_eip2333_bls12381_key_derivation.nim b/constantine/ethereum_eip2333_bls12381_key_derivation.nim index 6240abaf..b84765d0 100644 --- a/constantine/ethereum_eip2333_bls12381_key_derivation.nim +++ b/constantine/ethereum_eip2333_bls12381_key_derivation.nim @@ -9,7 +9,7 @@ import ./hashes, ./kdf/kdf_hkdf, - ./math/config/[curves, type_ff], + constantine/named/algebra, ./math/arithmetic/[bigints, limbs_montgomery], ./math/io/io_bigints, ./platforms/primitives, @@ -174,4 +174,4 @@ func derive_master_secretKey*( return false masterSecretKey.hkdf_mod_r(ikm, key_info = default(array[0, byte])) - return true \ No newline at end of file + return true diff --git a/constantine/ethereum_eip4844_kzg.nim b/constantine/ethereum_eip4844_kzg.nim index 93009b6d..6b8ba149 100644 --- a/constantine/ethereum_eip4844_kzg.nim +++ b/constantine/ethereum_eip4844_kzg.nim @@ -9,7 +9,7 @@ import std/typetraits, - ./math/config/curves, + constantine/named/algebra, ./math/io/[io_bigints, io_fields], ./math/[ec_shortweierstrass, arithmetic, extension_fields], ./math/arithmetic/limbs_montgomery, diff --git a/constantine/ethereum_eip4844_kzg_parallel.nim b/constantine/ethereum_eip4844_kzg_parallel.nim index f6ead30b..4278e96a 100644 --- a/constantine/ethereum_eip4844_kzg_parallel.nim +++ b/constantine/ethereum_eip4844_kzg_parallel.nim @@ -10,7 +10,7 @@ import ethereum_eip4844_kzg {.all.} export ethereum_eip4844_kzg import - ./math/config/curves, + constantine/named/algebra, ./math/[ec_shortweierstrass, arithmetic, extension_fields], ./math/polynomials/polynomials_parallel, ./hashes, diff --git a/constantine/ethereum_evm_precompiles.nim b/constantine/ethereum_evm_precompiles.nim index eccc03f4..910ea4c5 100644 --- a/constantine/ethereum_evm_precompiles.nim +++ b/constantine/ethereum_evm_precompiles.nim @@ -10,13 +10,13 @@ import ./hashes, ./platforms/abstractions, ./serialization/io_limbs, - ./math/config/curves, + constantine/named/algebra, ./math/[arithmetic, extension_fields], ./math/arithmetic/limbs_montgomery, ./math/ec_shortweierstrass, ./math/elliptic/ec_multi_scalar_mul, ./math/pairings/[pairings_generic, miller_accumulators], - ./math/constants/zoo_subgroups, + ./named/zoo_subgroups, ./math/io/[io_bigints, io_fields], ./math_arbitrary_precision/arithmetic/bigints_views, ./hash_to_curve/hash_to_curve diff --git a/constantine/ethereum_verkle_ipa.nim b/constantine/ethereum_verkle_ipa.nim index a8f26bdb..eb01137c 100644 --- a/constantine/ethereum_verkle_ipa.nim +++ b/constantine/ethereum_verkle_ipa.nim @@ -9,7 +9,7 @@ import ./commitments/eth_verkle_ipa, ./math/[arithmetic, ec_twistededwards], - ./math/config/curves, + constantine/named/algebra, ./serialization/[codecs_status_codes, codecs_banderwagon] # ------------------------------------------------------------ diff --git a/constantine/hash_to_curve/h2c_hash_to_field.nim b/constantine/hash_to_curve/h2c_hash_to_field.nim index bfb6c44d..c9895418 100644 --- a/constantine/hash_to_curve/h2c_hash_to_field.nim +++ b/constantine/hash_to_curve/h2c_hash_to_field.nim @@ -12,7 +12,7 @@ import ../serialization/endians, ../hashes, ../math/io/[io_bigints, io_fields], - ../math/config/curves, + constantine/named/algebra, ../math/arithmetic/limbs_montgomery, ../math/extension_fields/towers diff --git a/constantine/hash_to_curve/h2c_isogeny_maps.nim b/constantine/hash_to_curve/h2c_isogeny_maps.nim index edf72516..0786060d 100644 --- a/constantine/hash_to_curve/h2c_isogeny_maps.nim +++ b/constantine/hash_to_curve/h2c_isogeny_maps.nim @@ -10,7 +10,7 @@ import # Internals ../platforms/abstractions, ../math/[arithmetic, extension_fields], - ../math/constants/zoo_hash_to_curve, + ../named/zoo_hash_to_curve, ../math/elliptic/[ ec_shortweierstrass_projective, ec_shortweierstrass_jacobian, diff --git a/constantine/hash_to_curve/h2c_map_to_isocurve_swu.nim b/constantine/hash_to_curve/h2c_map_to_isocurve_swu.nim index 00fbc968..e9fb3ac8 100644 --- a/constantine/hash_to_curve/h2c_map_to_isocurve_swu.nim +++ b/constantine/hash_to_curve/h2c_map_to_isocurve_swu.nim @@ -9,9 +9,9 @@ import # Internals ../platforms/abstractions, - ../math/config/curves, + constantine/named/algebra, ../math/[arithmetic, extension_fields], - ../math/constants/zoo_hash_to_curve, + ../named/zoo_hash_to_curve, ./h2c_utilities # ############################################################ diff --git a/constantine/hash_to_curve/hash_to_curve.nim b/constantine/hash_to_curve/hash_to_curve.nim index 297fdab9..9c9d7a19 100644 --- a/constantine/hash_to_curve/hash_to_curve.nim +++ b/constantine/hash_to_curve/hash_to_curve.nim @@ -8,16 +8,16 @@ import # Internals - ../platforms/[abstractions, views], - ../math/config/curves, - ../math/[arithmetic, extension_fields], - ../math/constants/[zoo_hash_to_curve, zoo_subgroups], - ../math/ec_shortweierstrass, + constantine/platforms/[abstractions, views], + constantine/named/algebra, + constantine/named/[zoo_hash_to_curve, zoo_subgroups], + constantine/math/[arithmetic, extension_fields], + constantine/math/ec_shortweierstrass, + constantine/hashes, ./h2c_hash_to_field, ./h2c_map_to_isocurve_swu, ./h2c_isogeny_maps, - ./h2c_utilities, - ../hashes + ./h2c_utilities export abstractions, arithmetic # generic sandwich @@ -354,4 +354,4 @@ func hashToCurve*[F; G: static Subgroup]( when output is ECP_ShortW_Prj: output.projectiveFromJacobian(Pjac) else: - output.affine(Pjac) \ No newline at end of file + output.affine(Pjac) diff --git a/constantine/hashes/sha256/sha256_generic.nim b/constantine/hashes/sha256/sha256_generic.nim index 2e8dbd4d..b8929107 100644 --- a/constantine/hashes/sha256/sha256_generic.nim +++ b/constantine/hashes/sha256/sha256_generic.nim @@ -7,7 +7,7 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../../platforms/primitives + constantine/platforms/primitives # SHA256, a hash function from the SHA2 family # -------------------------------------------------------------------------------- diff --git a/constantine/hashes/sha256/sha256_x86_shaext.nim b/constantine/hashes/sha256/sha256_x86_shaext.nim index 4d381175..78a42ee6 100644 --- a/constantine/hashes/sha256/sha256_x86_shaext.nim +++ b/constantine/hashes/sha256/sha256_x86_shaext.nim @@ -7,8 +7,8 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../../platforms/isa/simd_x86, - ../../platforms/primitives, + constantine/platforms/isa/simd_x86, + constantine/platforms/primitives, ./sha256_generic {.localpassC:"-msse4.1 -msha".} @@ -42,7 +42,7 @@ func hashMessageBlocks_shaext*( ## Hash a message block by block ## Sha256 block size is 64 bytes hence ## a message will be process 64 by 64 bytes. - + var abef_save {.noInit.}: m128i cdgh_save {.noInit.}: m128i @@ -89,7 +89,7 @@ func hashMessageBlocks_shaext*( # Rounds 12-59 msgtmp[3] = shuf_u8x16(loadu_u128(data[16*3].addr), shuf_mask) - + staticFor i, 3, 15: let prev = (i-1) and 3 # mod 4, we rotate buffers let curr = i and 3 @@ -115,7 +115,7 @@ func hashMessageBlocks_shaext*( state1 = add_u32x4(state1, cdgh_save) data +%= BlockSize - + # The SHA state is stored in this order: # D, C, B, A, H, G, F, E # @@ -127,4 +127,4 @@ func hashMessageBlocks_shaext*( state1 = alignr_u128(state1, tmp, 8) # HGFE storea_u128(H.H[0].addr, state0) - storea_u128(H.H[4].addr, state1) \ No newline at end of file + storea_u128(H.H[4].addr, state1) diff --git a/constantine/hashes/sha256/sha256_x86_ssse3.nim b/constantine/hashes/sha256/sha256_x86_ssse3.nim index 857d47d9..8e774f26 100644 --- a/constantine/hashes/sha256/sha256_x86_ssse3.nim +++ b/constantine/hashes/sha256/sha256_x86_ssse3.nim @@ -7,8 +7,8 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../../platforms/isa/simd_x86, - ../../platforms/primitives, + constantine/platforms/isa/simd_x86, + constantine/platforms/primitives, ./sha256_generic {.localpassC:"-mssse3".} @@ -47,7 +47,7 @@ import # ------------------------------------------------ const VecNum = BlockSize div 16 # BlockSize / sizeof(m128i) -const VecWords = 16 div sizeof(Word) # sizeof(m128i) / sizeof(Word) +const VecWords = 16 div sizeof(Word) # sizeof(m128i) / sizeof(Word) func initMessageSchedule( msnext: var array[VecNum, m128i], @@ -56,7 +56,7 @@ func initMessageSchedule( ## Initial state, from data ## - Precompute steps for the future message schedule `msnext` ## - compute the current message schedule `ms` - + let mask = setr_u32x4(0x00010203, 0x04050607, 0x08090a0b, 0x0c0d0e0f) let pK256 = K256.unsafeAddr() @@ -115,7 +115,7 @@ func updateMessageSchedule( v[2] = xor_u128(v[2], v[3]) v[3] = shr_u64x2(v[3], rot1[1] - rot1[0]) - W[0] = add_u32x4(W[0], shuf_u8x16(xor_u128(v[2], v[3]), hi_mask)) + W[0] = add_u32x4(W[0], shuf_u8x16(xor_u128(v[2], v[3]), hi_mask)) W.rotateLeft() @@ -127,7 +127,7 @@ func sha256_rounds_0_47( ms: var Sha256_MessageSchedule, msnext: var array[VecNum, m128i]) {.inline.} = ## Process Sha256 rounds 0 to 47 - + let loMask = setr_u32x4(0x03020100, 0x0b0a0908, -1, -1) let hiMask = setr_u32x4(-1, -1, 0x03020100, 0x0b0a0908) diff --git a/constantine/math/arithmetic/assembly/limbs_asm_modular_dbl_prec_x86.nim b/constantine/math/arithmetic/assembly/limbs_asm_modular_dbl_prec_x86.nim index 5f3ed409..561fbc74 100644 --- a/constantine/math/arithmetic/assembly/limbs_asm_modular_dbl_prec_x86.nim +++ b/constantine/math/arithmetic/assembly/limbs_asm_modular_dbl_prec_x86.nim @@ -11,7 +11,7 @@ import std/macros, # Internal ./limbs_asm_modular_x86, - ../../../platforms/abstractions + constantine/platforms/abstractions # ############################################################ # # diff --git a/constantine/math/arithmetic/assembly/limbs_asm_modular_x86.nim b/constantine/math/arithmetic/assembly/limbs_asm_modular_x86.nim index a40944b5..12da5fcd 100644 --- a/constantine/math/arithmetic/assembly/limbs_asm_modular_x86.nim +++ b/constantine/math/arithmetic/assembly/limbs_asm_modular_x86.nim @@ -10,7 +10,7 @@ import # Standard library std/macros, # Internal - ../../../platforms/abstractions + constantine/platforms/abstractions # ############################################################ # diff --git a/constantine/math/arithmetic/assembly/limbs_asm_mul_mont_x86.nim b/constantine/math/arithmetic/assembly/limbs_asm_mul_mont_x86.nim index 0db043a3..797a4306 100644 --- a/constantine/math/arithmetic/assembly/limbs_asm_mul_mont_x86.nim +++ b/constantine/math/arithmetic/assembly/limbs_asm_mul_mont_x86.nim @@ -10,7 +10,7 @@ import # Standard library std/macros, # Internal - ../../../platforms/abstractions, + constantine/platforms/abstractions, ./limbs_asm_modular_x86, ./limbs_asm_redc_mont_x86, ./limbs_asm_mul_x86 @@ -374,4 +374,4 @@ func sumprodMont_CIOS_spare2bits_asm*[N, K: static int]( ## otherwise the result is in the range [0, M) ## ## This procedure can only be called if the modulus doesn't use the full bitwidth of its underlying representation - r.sumprodMont_CIOS_spare2bits_gen(a, b, M, m0ninv, skipFinalSub) \ No newline at end of file + r.sumprodMont_CIOS_spare2bits_gen(a, b, M, m0ninv, skipFinalSub) diff --git a/constantine/math/arithmetic/assembly/limbs_asm_mul_mont_x86_adx_bmi2.nim b/constantine/math/arithmetic/assembly/limbs_asm_mul_mont_x86_adx_bmi2.nim index f3daaabe..12298f1c 100644 --- a/constantine/math/arithmetic/assembly/limbs_asm_mul_mont_x86_adx_bmi2.nim +++ b/constantine/math/arithmetic/assembly/limbs_asm_mul_mont_x86_adx_bmi2.nim @@ -10,7 +10,7 @@ import # Standard library std/macros, # Internal - ../../../platforms/abstractions, + constantine/platforms/abstractions, ./limbs_asm_modular_x86, ./limbs_asm_redc_mont_x86_adx_bmi2, ./limbs_asm_mul_x86_adx_bmi2 @@ -459,4 +459,4 @@ func sumprodMont_CIOS_spare2bits_asm_adx*[N, K: static int]( ## otherwise the result is in the range [0, M) ## ## This procedure can only be called if the modulus doesn't use the full bitwidth of its underlying representation - r.sumprodMont_CIOS_spare2bits_adx_gen(a, b, M, m0ninv, skipFinalSub) \ No newline at end of file + r.sumprodMont_CIOS_spare2bits_adx_gen(a, b, M, m0ninv, skipFinalSub) diff --git a/constantine/math/arithmetic/assembly/limbs_asm_mul_x86.nim b/constantine/math/arithmetic/assembly/limbs_asm_mul_x86.nim index 358f0bd4..a352ac14 100644 --- a/constantine/math/arithmetic/assembly/limbs_asm_mul_x86.nim +++ b/constantine/math/arithmetic/assembly/limbs_asm_mul_x86.nim @@ -10,7 +10,7 @@ import # Standard library std/macros, # Internal - ../../../platforms/abstractions + constantine/platforms/abstractions # ############################################################ # diff --git a/constantine/math/arithmetic/assembly/limbs_asm_mul_x86_adx_bmi2.nim b/constantine/math/arithmetic/assembly/limbs_asm_mul_x86_adx_bmi2.nim index 18f472ba..50cad165 100644 --- a/constantine/math/arithmetic/assembly/limbs_asm_mul_x86_adx_bmi2.nim +++ b/constantine/math/arithmetic/assembly/limbs_asm_mul_x86_adx_bmi2.nim @@ -10,7 +10,7 @@ import # Standard library std/macros, # Internal - ../../../platforms/abstractions + constantine/platforms/abstractions # ############################################################ # diff --git a/constantine/math/arithmetic/assembly/limbs_asm_redc_mont_x86.nim b/constantine/math/arithmetic/assembly/limbs_asm_redc_mont_x86.nim index a47284d1..bce6e0ea 100644 --- a/constantine/math/arithmetic/assembly/limbs_asm_redc_mont_x86.nim +++ b/constantine/math/arithmetic/assembly/limbs_asm_redc_mont_x86.nim @@ -10,7 +10,7 @@ import # Standard library std/macros, # Internal - ../../../platforms/abstractions, + constantine/platforms/abstractions, ./limbs_asm_modular_x86 # ############################################################ diff --git a/constantine/math/arithmetic/assembly/limbs_asm_redc_mont_x86_adx_bmi2.nim b/constantine/math/arithmetic/assembly/limbs_asm_redc_mont_x86_adx_bmi2.nim index f767eadf..41f21773 100644 --- a/constantine/math/arithmetic/assembly/limbs_asm_redc_mont_x86_adx_bmi2.nim +++ b/constantine/math/arithmetic/assembly/limbs_asm_redc_mont_x86_adx_bmi2.nim @@ -10,7 +10,7 @@ import # Standard library std/macros, # Internal - ../../../platforms/abstractions, + constantine/platforms/abstractions, ./limbs_asm_modular_x86 # ############################################################ diff --git a/constantine/math/arithmetic/assembly/limbs_asm_x86.nim b/constantine/math/arithmetic/assembly/limbs_asm_x86.nim index 8e6f37a5..6c02aada 100644 --- a/constantine/math/arithmetic/assembly/limbs_asm_x86.nim +++ b/constantine/math/arithmetic/assembly/limbs_asm_x86.nim @@ -10,7 +10,7 @@ import # Standard library std/macros, # Internal - ../../../platforms/abstractions + constantine/platforms/abstractions # ############################################################ # diff --git a/constantine/math/arithmetic/bigints.nim b/constantine/math/arithmetic/bigints.nim index 209e3e52..97bce194 100644 --- a/constantine/math/arithmetic/bigints.nim +++ b/constantine/math/arithmetic/bigints.nim @@ -7,12 +7,11 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../../platforms/abstractions, - ../config/type_bigint, + constantine/platforms/abstractions, ./limbs, ./limbs_extmul, ./limbs_exgcd, - ../../math_arbitrary_precision/arithmetic/[ + constantine/math_arbitrary_precision/arithmetic/[ limbs_divmod, limbs_divmod_vartime] export BigInt diff --git a/constantine/math/arithmetic/bigints_montgomery.nim b/constantine/math/arithmetic/bigints_montgomery.nim index e538c16e..4836ed96 100644 --- a/constantine/math/arithmetic/bigints_montgomery.nim +++ b/constantine/math/arithmetic/bigints_montgomery.nim @@ -7,8 +7,8 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../../platforms/abstractions, - ../io/io_bigints, + constantine/platforms/abstractions, + constantine/math/io/io_bigints, ./limbs, ./limbs_montgomery, ./bigints diff --git a/constantine/math/arithmetic/finite_fields.nim b/constantine/math/arithmetic/finite_fields.nim index fa58af68..95890bfd 100644 --- a/constantine/math/arithmetic/finite_fields.nim +++ b/constantine/math/arithmetic/finite_fields.nim @@ -27,16 +27,16 @@ # which requires a prime import - ../../platforms/abstractions, + constantine/platforms/[abstractions, type_ff], ../../serialization/endians, - ../config/[type_ff, curves_prop_field_core, curves_prop_field_derived], + constantine/named/properties_fields, ./bigints, ./bigints_montgomery when UseASM_X86_64: import ./assembly/limbs_asm_modular_x86 when nimvm: - from ../config/precompute import montyResidue_precompute + from constantine/named/deriv/precompute import montyResidue_precompute else: discard diff --git a/constantine/math/arithmetic/finite_fields_double_precision.nim b/constantine/math/arithmetic/finite_fields_double_precision.nim index 4b270a72..7536f31a 100644 --- a/constantine/math/arithmetic/finite_fields_double_precision.nim +++ b/constantine/math/arithmetic/finite_fields_double_precision.nim @@ -7,8 +7,8 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../../platforms/abstractions, - ../config/curves, + constantine/platforms/abstractions, + constantine/named/algebra, ./bigints, ./finite_fields, ./limbs, diff --git a/constantine/math/arithmetic/finite_fields_square_root.nim b/constantine/math/arithmetic/finite_fields_square_root.nim index 8450e027..cb70ef6c 100644 --- a/constantine/math/arithmetic/finite_fields_square_root.nim +++ b/constantine/math/arithmetic/finite_fields_square_root.nim @@ -7,9 +7,9 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../../platforms/abstractions, - ../config/curves, - ../constants/zoo_square_roots, + constantine/platforms/abstractions, + constantine/named/algebra, + constantine/named/zoo_square_roots, ./finite_fields_square_root_precomp, ./bigints, ./finite_fields, ./limbs_exgcd diff --git a/constantine/math/arithmetic/finite_fields_square_root_precomp.nim b/constantine/math/arithmetic/finite_fields_square_root_precomp.nim index d786b4de..aa6b6e77 100644 --- a/constantine/math/arithmetic/finite_fields_square_root_precomp.nim +++ b/constantine/math/arithmetic/finite_fields_square_root_precomp.nim @@ -11,8 +11,8 @@ import std/tables, - ../../platforms/abstractions, - ../constants/zoo_square_roots, + constantine/platforms/abstractions, + constantine/named/zoo_square_roots, ./bigints, ./finite_fields # ############################################################ diff --git a/constantine/math/arithmetic/limbs.nim b/constantine/math/arithmetic/limbs.nim index 2aa90f1b..df5f7d2c 100644 --- a/constantine/math/arithmetic/limbs.nim +++ b/constantine/math/arithmetic/limbs.nim @@ -6,7 +6,7 @@ # * Apache v2 license (license terms in the root directory or at http://www.apache.org/licenses/LICENSE-2.0). # at your option. This file may not be copied, modified, or distributed except according to those terms. -import ../../platforms/abstractions +import constantine/platforms/abstractions when UseASM_X86_32: import ./assembly/limbs_asm_x86 diff --git a/constantine/math/arithmetic/limbs_exgcd.nim b/constantine/math/arithmetic/limbs_exgcd.nim index 9fdbfd9f..fe260641 100644 --- a/constantine/math/arithmetic/limbs_exgcd.nim +++ b/constantine/math/arithmetic/limbs_exgcd.nim @@ -7,7 +7,7 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../../platforms/abstractions, + constantine/platforms/abstractions, ./limbs, ./limbs_unsaturated # No exceptions allowed diff --git a/constantine/math/arithmetic/limbs_extmul.nim b/constantine/math/arithmetic/limbs_extmul.nim index 9a2da2af..0063d09b 100644 --- a/constantine/math/arithmetic/limbs_extmul.nim +++ b/constantine/math/arithmetic/limbs_extmul.nim @@ -7,7 +7,7 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../../platforms/abstractions, + constantine/platforms/abstractions, ./limbs when UseASM_X86_64: diff --git a/constantine/math/arithmetic/limbs_montgomery.nim b/constantine/math/arithmetic/limbs_montgomery.nim index 97cd6e1a..90d10edc 100644 --- a/constantine/math/arithmetic/limbs_montgomery.nim +++ b/constantine/math/arithmetic/limbs_montgomery.nim @@ -8,7 +8,7 @@ import # Internal - ../../platforms/abstractions, + constantine/platforms/abstractions, ./limbs, ./limbs_extmul when UseASM_X86_32: diff --git a/constantine/math/arithmetic/limbs_unsaturated.nim b/constantine/math/arithmetic/limbs_unsaturated.nim index d9c98475..074df4d8 100644 --- a/constantine/math/arithmetic/limbs_unsaturated.nim +++ b/constantine/math/arithmetic/limbs_unsaturated.nim @@ -6,7 +6,7 @@ # * Apache v2 license (license terms in the root directory or at http://www.apache.org/licenses/LICENSE-2.0). # at your option. This file may not be copied, modified, or distributed except according to those terms. -import ../../platforms/abstractions +import constantine/platforms/abstractions type LimbsUnsaturated*[N, Excess: static int] = object diff --git a/constantine/math/config/curves_prop_field_core.nim b/constantine/math/config/curves_prop_field_core.nim deleted file mode 100644 index 668c2784..00000000 --- a/constantine/math/config/curves_prop_field_core.nim +++ /dev/null @@ -1,58 +0,0 @@ -# Copyright (c) 2018-2019 Status Research & Development GmbH -# Copyright (c) 2020-Present Mamy André-Ratsimbazafy -# Licensed and distributed under either of -# * MIT license (license terms in the root directory or at http://opensource.org/licenses/MIT). -# * Apache v2 license (license terms in the root directory or at http://www.apache.org/licenses/LICENSE-2.0). -# at your option. This file may not be copied, modified, or distributed except according to those terms. - -import - # Standard library - std/macros, - # Internal - ../../platforms/abstractions, - ./type_bigint, - ./curves_declaration - -export Curve - -# ############################################################ -# -# Field properties -# -# ############################################################ - -{.experimental: "dynamicBindSym".} - -macro Mod*(C: static Curve): untyped = - ## Get the Modulus associated to a curve - result = bindSym($C & "_Modulus") - -template matchingBigInt*(C: static Curve): untyped = - ## BigInt type necessary to store the prime field Fp - # Workaround: https://github.com/nim-lang/Nim/issues/16774 - BigInt[CurveBitWidth[C]] - -template matchingOrderBigInt*(C: static Curve): untyped = - ## BigInt type necessary to store the scalar field Fr - # Workaround: https://github.com/nim-lang/Nim/issues/16774 - BigInt[CurveOrderBitWidth[C]] - -template matchingLimbs2x*(C: Curve): untyped = - const N2 = wordsRequired(CurveBitWidth[C]) * 2 # TODO upstream, not precomputing N2 breaks semcheck - array[N2, SecretWord] # TODO upstream, using Limbs[N2] breaks semcheck - -func has_P_3mod4_primeModulus*(C: static Curve): static bool = - ## Returns true iff p ≡ 3 (mod 4) - (BaseType(C.Mod.limbs[0]) and 3) == 3 - -func has_P_5mod8_primeModulus*(C: static Curve): static bool = - ## Returns true iff p ≡ 5 (mod 8) - (BaseType(C.Mod.limbs[0]) and 7) == 5 - -func has_P_9mod16_primeModulus*(C: static Curve): static bool = - ## Returns true iff p ≡ 9 (mod 16) - (BaseType(C.Mod.limbs[0]) and 15) == 9 - -func has_Psquare_9mod16_primePower*(C: static Curve): static bool = - ## Returns true iff p² ≡ 9 (mod 16) - ((BaseType(C.Mod.limbs[0]) * BaseType(C.Mod.limbs[0])) and 15) == 9 \ No newline at end of file diff --git a/constantine/math/config/type_bigint.nim b/constantine/math/config/type_bigint.nim deleted file mode 100644 index 5171ba4f..00000000 --- a/constantine/math/config/type_bigint.nim +++ /dev/null @@ -1,32 +0,0 @@ -# Constantine -# Copyright (c) 2018-2019 Status Research & Development GmbH -# Copyright (c) 2020-Present Mamy André-Ratsimbazafy -# Licensed and distributed under either of -# * MIT license (license terms in the root directory or at http://opensource.org/licenses/MIT). -# * Apache v2 license (license terms in the root directory or at http://www.apache.org/licenses/LICENSE-2.0). -# at your option. This file may not be copied, modified, or distributed except according to those terms. - -import ../../platforms/abstractions - -type - BigInt*[bits: static int] = object - ## Fixed-precision big integer - ## - ## - "bits" is the announced bit-length of the BigInt - ## This is public data, usually equal to the curve prime bitlength. - ## - ## - "limbs" is an internal field that holds the internal representation - ## of the big integer. Least-significant limb first. Within limbs words are native-endian. - ## - ## This internal representation can be changed - ## without notice and should not be used by external applications or libraries. - limbs*: array[bits.wordsRequired, SecretWord] - - -debug: - func `$`*(a: BigInt): string = - result = "BigInt[" - result.add $BigInt.bits - result.add "](limbs: " - result.add a.limbs.toString() - result.add ")" diff --git a/constantine/math/ec_shortweierstrass.nim b/constantine/math/ec_shortweierstrass.nim index bf86b7d4..b904e18d 100644 --- a/constantine/math/ec_shortweierstrass.nim +++ b/constantine/math/ec_shortweierstrass.nim @@ -22,7 +22,7 @@ import ec_scalar_mul, ec_scalar_mul_vartime, ec_multi_scalar_mul, ], - ./constants/zoo_generators + ../named/zoo_generators export ec_shortweierstrass_affine, ec_shortweierstrass_jacobian, ec_shortweierstrass_projective, ec_shortweierstrass_batch_ops, ec_scalar_mul, ec_scalar_mul_vartime, diff --git a/constantine/math/ec_twistededwards.nim b/constantine/math/ec_twistededwards.nim index d512ff95..3c5ae23b 100644 --- a/constantine/math/ec_twistededwards.nim +++ b/constantine/math/ec_twistededwards.nim @@ -20,7 +20,7 @@ import ec_scalar_mul, ec_scalar_mul_vartime, ec_multi_scalar_mul, ], - ./constants/zoo_generators + ../named/zoo_generators export ec_twistededwards_affine, ec_twistededwards_projective, ec_twistededwards_batch_ops, ec_scalar_mul, ec_scalar_mul_vartime, diff --git a/constantine/math/elliptic/ec_endomorphism_accel.nim b/constantine/math/elliptic/ec_endomorphism_accel.nim index e300cbcb..2f3c3d22 100644 --- a/constantine/math/elliptic/ec_endomorphism_accel.nim +++ b/constantine/math/elliptic/ec_endomorphism_accel.nim @@ -10,12 +10,12 @@ import # Standard Library std/typetraits, # Internal - ../../platforms/abstractions, - ../config/[curves, type_bigint], - ../constants/zoo_endomorphisms, - ../arithmetic, - ../extension_fields, - ../isogenies/frobenius, + constantine/platforms/abstractions, + constantine/named/algebra, + constantine/named/zoo_endomorphisms, + constantine/math/arithmetic, + constantine/math/extension_fields, + constantine/math/isogenies/frobenius, ./ec_shortweierstrass_affine, ./ec_shortweierstrass_batch_ops diff --git a/constantine/math/elliptic/ec_multi_scalar_mul.nim b/constantine/math/elliptic/ec_multi_scalar_mul.nim index a63f70b3..071aa4f7 100644 --- a/constantine/math/elliptic/ec_multi_scalar_mul.nim +++ b/constantine/math/elliptic/ec_multi_scalar_mul.nim @@ -6,12 +6,12 @@ # * Apache v2 license (license terms in the root directory or at http://www.apache.org/licenses/LICENSE-2.0). # at your option. This file may not be copied, modified, or distributed except according to those terms. -import ../config/curves, +import constantine/named/algebra, ./ec_multi_scalar_mul_scheduler, ./ec_endomorphism_accel, - ../extension_fields, - ../isogenies/frobenius, - ../constants/zoo_endomorphisms + constantine/math/extension_fields, + constantine/math/isogenies/frobenius, + constantine/named/zoo_endomorphisms export bestBucketBitSize # No exceptions allowed in core cryptographic operations diff --git a/constantine/math/elliptic/ec_multi_scalar_mul_parallel.nim b/constantine/math/elliptic/ec_multi_scalar_mul_parallel.nim index 94ac624f..c97cccfc 100644 --- a/constantine/math/elliptic/ec_multi_scalar_mul_parallel.nim +++ b/constantine/math/elliptic/ec_multi_scalar_mul_parallel.nim @@ -6,13 +6,13 @@ # * Apache v2 license (license terms in the root directory or at http://www.apache.org/licenses/LICENSE-2.0). # at your option. This file may not be copied, modified, or distributed except according to those terms. -import ../config/curves, +import constantine/named/algebra, ./ec_multi_scalar_mul_scheduler, ./ec_multi_scalar_mul, ./ec_endomorphism_accel, - ../extension_fields, - ../isogenies/frobenius, - ../constants/zoo_endomorphisms, + constantine/math/extension_fields, + constantine/math/isogenies/frobenius, + constantine/named/zoo_endomorphisms, ../../threadpool/[threadpool, partitioners] export bestBucketBitSize diff --git a/constantine/math/elliptic/ec_multi_scalar_mul_scheduler.nim b/constantine/math/elliptic/ec_multi_scalar_mul_scheduler.nim index cc8fb2d8..e37c2603 100644 --- a/constantine/math/elliptic/ec_multi_scalar_mul_scheduler.nim +++ b/constantine/math/elliptic/ec_multi_scalar_mul_scheduler.nim @@ -7,8 +7,8 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../../platforms/abstractions, - ../arithmetic, + constantine/platforms/abstractions, + constantine/math/arithmetic, ./ec_shortweierstrass_affine, ./ec_shortweierstrass_jacobian, ./ec_shortweierstrass_projective, diff --git a/constantine/math/elliptic/ec_scalar_mul.nim b/constantine/math/elliptic/ec_scalar_mul.nim index 32c4225f..f651bfc8 100644 --- a/constantine/math/elliptic/ec_scalar_mul.nim +++ b/constantine/math/elliptic/ec_scalar_mul.nim @@ -7,12 +7,12 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../../platforms/abstractions, - ../config/curves, - ../arithmetic, - ../extension_fields, - ../io/io_bigints, - ../constants/zoo_endomorphisms, + constantine/platforms/abstractions, + constantine/named/algebra, + constantine/math/arithmetic, + constantine/math/extension_fields, + constantine/math/io/io_bigints, + constantine/named/zoo_endomorphisms, ./ec_endomorphism_accel # ############################################################ diff --git a/constantine/math/elliptic/ec_scalar_mul_vartime.nim b/constantine/math/elliptic/ec_scalar_mul_vartime.nim index ede5e157..7062d4a0 100644 --- a/constantine/math/elliptic/ec_scalar_mul_vartime.nim +++ b/constantine/math/elliptic/ec_scalar_mul_vartime.nim @@ -14,13 +14,13 @@ import ./ec_endomorphism_accel, ./ec_shortweierstrass_batch_ops, ./ec_twistededwards_batch_ops, - ../arithmetic, - ../extension_fields, - ../io/io_bigints, - ../constants/zoo_endomorphisms, - ../isogenies/frobenius, - ../../platforms/abstractions, - ../../math_arbitrary_precision/arithmetic/limbs_views + constantine/math/arithmetic, + constantine/math/extension_fields, + constantine/math/io/io_bigints, + constantine/named/zoo_endomorphisms, + constantine/math/isogenies/frobenius, + constantine/platforms/abstractions, + constantine/math_arbitrary_precision/arithmetic/limbs_views {.push raises: [].} # No exceptions allowed in core cryptographic operations {.push checks: off.} # No defects due to array bound checking or signed integer overflow allowed diff --git a/constantine/math/elliptic/ec_shortweierstrass_affine.nim b/constantine/math/elliptic/ec_shortweierstrass_affine.nim index 47bdf89e..21a842bf 100644 --- a/constantine/math/elliptic/ec_shortweierstrass_affine.nim +++ b/constantine/math/elliptic/ec_shortweierstrass_affine.nim @@ -7,12 +7,12 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../../platforms/abstractions, - ../config/curves, - ../arithmetic, - ../extension_fields, - ../io/[io_fields, io_extfields], - ../constants/zoo_constants + constantine/platforms/abstractions, + constantine/named/algebra, + constantine/math/arithmetic, + constantine/math/extension_fields, + constantine/math/io/[io_fields, io_extfields], + constantine/named/zoo_constants # No exceptions allowed {.push raises: [].} diff --git a/constantine/math/elliptic/ec_shortweierstrass_batch_ops.nim b/constantine/math/elliptic/ec_shortweierstrass_batch_ops.nim index 755e09ce..f2b8f89b 100644 --- a/constantine/math/elliptic/ec_shortweierstrass_batch_ops.nim +++ b/constantine/math/elliptic/ec_shortweierstrass_batch_ops.nim @@ -7,9 +7,9 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../../platforms/abstractions, - ../arithmetic, - ../extension_fields, + constantine/platforms/abstractions, + constantine/math/arithmetic, + constantine/math/extension_fields, ./ec_shortweierstrass_affine, ./ec_shortweierstrass_jacobian, ./ec_shortweierstrass_projective, diff --git a/constantine/math/elliptic/ec_shortweierstrass_batch_ops_parallel.nim b/constantine/math/elliptic/ec_shortweierstrass_batch_ops_parallel.nim index 3fa36b47..0dcdb249 100644 --- a/constantine/math/elliptic/ec_shortweierstrass_batch_ops_parallel.nim +++ b/constantine/math/elliptic/ec_shortweierstrass_batch_ops_parallel.nim @@ -7,7 +7,7 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../../platforms/abstractions, + constantine/platforms/abstractions, ../../threadpool/[threadpool, partitioners], ./ec_shortweierstrass_affine, ./ec_shortweierstrass_jacobian, diff --git a/constantine/math/elliptic/ec_shortweierstrass_jacobian.nim b/constantine/math/elliptic/ec_shortweierstrass_jacobian.nim index dea51ee6..135e63a7 100644 --- a/constantine/math/elliptic/ec_shortweierstrass_jacobian.nim +++ b/constantine/math/elliptic/ec_shortweierstrass_jacobian.nim @@ -7,10 +7,10 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../../platforms/abstractions, - ../config/curves, - ../arithmetic, - ../extension_fields, + constantine/platforms/abstractions, + constantine/named/algebra, + constantine/math/arithmetic, + constantine/math/extension_fields, ./ec_shortweierstrass_affine export Subgroup diff --git a/constantine/math/elliptic/ec_shortweierstrass_jacobian_extended.nim b/constantine/math/elliptic/ec_shortweierstrass_jacobian_extended.nim index c3852138..3c124e52 100644 --- a/constantine/math/elliptic/ec_shortweierstrass_jacobian_extended.nim +++ b/constantine/math/elliptic/ec_shortweierstrass_jacobian_extended.nim @@ -7,10 +7,10 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../../platforms/abstractions, - ../config/curves, - ../arithmetic, - ../extension_fields, + constantine/platforms/abstractions, + constantine/named/algebra, + constantine/math/arithmetic, + constantine/math/extension_fields, ./ec_shortweierstrass_affine, ./ec_shortweierstrass_projective, ./ec_shortweierstrass_jacobian diff --git a/constantine/math/elliptic/ec_shortweierstrass_projective.nim b/constantine/math/elliptic/ec_shortweierstrass_projective.nim index 34986e5c..fc16c0ca 100644 --- a/constantine/math/elliptic/ec_shortweierstrass_projective.nim +++ b/constantine/math/elliptic/ec_shortweierstrass_projective.nim @@ -7,10 +7,10 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../../platforms/abstractions, - ../config/curves, - ../arithmetic, - ../extension_fields, + constantine/platforms/abstractions, + constantine/named/algebra, + constantine/math/arithmetic, + constantine/math/extension_fields, ./ec_shortweierstrass_affine export Subgroup diff --git a/constantine/math/elliptic/ec_twistededwards_affine.nim b/constantine/math/elliptic/ec_twistededwards_affine.nim index cb0c2cd8..26f5899e 100644 --- a/constantine/math/elliptic/ec_twistededwards_affine.nim +++ b/constantine/math/elliptic/ec_twistededwards_affine.nim @@ -7,11 +7,11 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../../platforms/abstractions, - ../config/curves, - ../arithmetic, - ../extension_fields, - ../io/[io_fields, io_extfields] + constantine/platforms/abstractions, + constantine/named/algebra, + constantine/math/arithmetic, + constantine/math/extension_fields, + constantine/math/io/[io_fields, io_extfields] # ############################################################ # diff --git a/constantine/math/elliptic/ec_twistededwards_batch_ops.nim b/constantine/math/elliptic/ec_twistededwards_batch_ops.nim index 474eaa7e..6fc72ffd 100644 --- a/constantine/math/elliptic/ec_twistededwards_batch_ops.nim +++ b/constantine/math/elliptic/ec_twistededwards_batch_ops.nim @@ -7,8 +7,8 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../../platforms/abstractions, - ../arithmetic, + constantine/platforms/abstractions, + constantine/math/arithmetic, ./ec_twistededwards_affine, ./ec_twistededwards_projective diff --git a/constantine/math/elliptic/ec_twistededwards_projective.nim b/constantine/math/elliptic/ec_twistededwards_projective.nim index 9909c835..b4406977 100644 --- a/constantine/math/elliptic/ec_twistededwards_projective.nim +++ b/constantine/math/elliptic/ec_twistededwards_projective.nim @@ -7,10 +7,10 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../../platforms/abstractions, - ../config/curves, - ../arithmetic, - ../extension_fields, + constantine/platforms/abstractions, + constantine/named/algebra, + constantine/math/arithmetic, + constantine/math/extension_fields, ./ec_twistededwards_affine diff --git a/constantine/math/extension_fields/assembly/fp2_asm_x86_adx_bmi2.nim b/constantine/math/extension_fields/assembly/fp2_asm_x86_adx_bmi2.nim index 21c81f40..eb5d0b09 100644 --- a/constantine/math/extension_fields/assembly/fp2_asm_x86_adx_bmi2.nim +++ b/constantine/math/extension_fields/assembly/fp2_asm_x86_adx_bmi2.nim @@ -8,10 +8,10 @@ import # Internal - ../../../platforms/abstractions, - ../../config/curves, - ../../arithmetic, - ../../arithmetic/assembly/[ + constantine/platforms/abstractions, + constantine/named/algebra, + constantine/math/arithmetic, + constantine/math/arithmetic/assembly/[ limbs_asm_mul_x86_adx_bmi2, limbs_asm_mul_mont_x86_adx_bmi2, limbs_asm_redc_mont_x86_adx_bmi2 diff --git a/constantine/math/extension_fields/exponentiations.nim b/constantine/math/extension_fields/exponentiations.nim index a9986b3b..5e995d53 100644 --- a/constantine/math/extension_fields/exponentiations.nim +++ b/constantine/math/extension_fields/exponentiations.nim @@ -8,9 +8,9 @@ import - ../../platforms/abstractions, - ../arithmetic, - ../io/io_bigints, + constantine/platforms/abstractions, + constantine/math/arithmetic, + constantine/math/io/io_bigints, ./towers # ############################################################ diff --git a/constantine/math/extension_fields/square_root_fp2.nim b/constantine/math/extension_fields/square_root_fp2.nim index b6c2cf52..7b8fffaf 100644 --- a/constantine/math/extension_fields/square_root_fp2.nim +++ b/constantine/math/extension_fields/square_root_fp2.nim @@ -7,11 +7,11 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../../platforms/abstractions, + constantine/platforms/abstractions, ./towers, - ../arithmetic, - ../config/curves, - ../constants/zoo_square_roots_fp2 + constantine/math/arithmetic, + constantine/named/algebra, + constantine/named/zoo_square_roots_fp2 # Square root # ----------------------------------------------------------- @@ -209,4 +209,4 @@ func sqrt*(a: var Fp2) = ## ## The square root, if it exist is multivalued, ## i.e. both x² == (-x)² - discard a.sqrt_if_square() \ No newline at end of file + discard a.sqrt_if_square() diff --git a/constantine/math/extension_fields/towers.nim b/constantine/math/extension_fields/towers.nim index eccbff1d..6b46c427 100644 --- a/constantine/math/extension_fields/towers.nim +++ b/constantine/math/extension_fields/towers.nim @@ -7,10 +7,10 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../../platforms/abstractions, - ../config/curves, - ../arithmetic, - ../io/io_fields + constantine/platforms/abstractions, + constantine/named/algebra, + constantine/math/arithmetic, + constantine/math/io/io_fields export Fp diff --git a/constantine/math/io/io_bigints.nim b/constantine/math/io/io_bigints.nim index 9bb123bf..1284943a 100644 --- a/constantine/math/io/io_bigints.nim +++ b/constantine/math/io/io_bigints.nim @@ -11,10 +11,9 @@ # - Burning memory to ensure secrets are not left after dealloc. import - ../../platforms/abstractions, + constantine/platforms/abstractions, ../../serialization/[codecs, io_limbs], - ../arithmetic/bigints, - ../config/type_bigint + constantine/math/arithmetic/bigints export BigInt, wordsRequired diff --git a/constantine/math/io/io_ec.nim b/constantine/math/io/io_ec.nim index 28493025..2e891818 100644 --- a/constantine/math/io/io_ec.nim +++ b/constantine/math/io/io_ec.nim @@ -7,11 +7,11 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../../platforms/primitives, + constantine/platforms/primitives, ./io_bigints, ./io_fields, ./io_extfields, - ../arithmetic, - ../extension_fields, - ../elliptic/[ + constantine/math/arithmetic, + constantine/math/extension_fields, + constantine/math/elliptic/[ ec_shortweierstrass_affine, ec_shortweierstrass_projective, ec_shortweierstrass_jacobian, diff --git a/constantine/math/io/io_extfields.nim b/constantine/math/io/io_extfields.nim index b6227076..99436f0a 100644 --- a/constantine/math/io/io_extfields.nim +++ b/constantine/math/io/io_extfields.nim @@ -12,9 +12,9 @@ import std/typetraits, # Internal ./io_bigints, ./io_fields, - ../../platforms/primitives, - ../arithmetic/finite_fields, - ../extension_fields/towers + constantine/platforms/primitives, + constantine/math/arithmetic/finite_fields, + constantine/math/extension_fields/towers export towers diff --git a/constantine/math/io/io_fields.nim b/constantine/math/io/io_fields.nim index 22ff09b6..c28f2567 100644 --- a/constantine/math/io/io_fields.nim +++ b/constantine/math/io/io_fields.nim @@ -8,8 +8,8 @@ import ./io_bigints, - ../../platforms/abstractions, - ../arithmetic/finite_fields + constantine/platforms/abstractions, + constantine/math/arithmetic/finite_fields export Fp diff --git a/constantine/math/isogenies/frobenius.nim b/constantine/math/isogenies/frobenius.nim index 5440519a..7e71717b 100644 --- a/constantine/math/isogenies/frobenius.nim +++ b/constantine/math/isogenies/frobenius.nim @@ -8,10 +8,10 @@ import std/macros, - ../../platforms/primitives, - ../arithmetic, - ../extension_fields, - ../constants/zoo_frobenius + constantine/platforms/primitives, + constantine/math/arithmetic, + constantine/math/extension_fields, + constantine/named/zoo_frobenius # Frobenius Map # ------------------------------------------------------------ diff --git a/constantine/math/pairings/cyclotomic_subgroups.nim b/constantine/math/pairings/cyclotomic_subgroups.nim index 819b6199..9d411979 100644 --- a/constantine/math/pairings/cyclotomic_subgroups.nim +++ b/constantine/math/pairings/cyclotomic_subgroups.nim @@ -7,11 +7,11 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../../platforms/abstractions, - ../config/curves, - ../arithmetic, - ../extension_fields, - ../isogenies/frobenius + constantine/platforms/abstractions, + constantine/named/algebra, + constantine/math/arithmetic, + constantine/math/extension_fields, + constantine/math/isogenies/frobenius # No exceptions allowed {.push raises: [].} diff --git a/constantine/math/pairings/lines_eval.nim b/constantine/math/pairings/lines_eval.nim index 200c9cb2..ceff4aa5 100644 --- a/constantine/math/pairings/lines_eval.nim +++ b/constantine/math/pairings/lines_eval.nim @@ -8,16 +8,16 @@ import std/typetraits, - ../config/curves, - ../../platforms/abstractions, - ../arithmetic, - ../extension_fields, - ../elliptic/[ + constantine/named/algebra, + constantine/platforms/abstractions, + constantine/math/arithmetic, + constantine/math/extension_fields, + constantine/math/elliptic/[ ec_shortweierstrass_affine, ec_shortweierstrass_projective ], - ../io/io_extfields, - ../constants/zoo_constants + constantine/math/io/io_extfields, + constantine/named/zoo_constants # No exceptions allowed {.push raises: [].} @@ -1398,4 +1398,4 @@ func mul_by_2_lines*[Fpk, Fpkdiv6](f: var Fpk, line0, line1: Line[Fpkdiv6]) {.in t.prod_from_2_lines(line0, line1) f.mul_by_prod_of_2_lines(t) -# func asFpk \ No newline at end of file +# func asFpk diff --git a/constantine/math/pairings/miller_accumulators.nim b/constantine/math/pairings/miller_accumulators.nim index 1db95ac7..f82079c6 100644 --- a/constantine/math/pairings/miller_accumulators.nim +++ b/constantine/math/pairings/miller_accumulators.nim @@ -7,9 +7,9 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../extension_fields, - ../elliptic/ec_shortweierstrass_affine, - ../arithmetic, + constantine/math/extension_fields, + constantine/math/elliptic/ec_shortweierstrass_affine, + constantine/math/arithmetic, ./pairings_generic {.push raises: [].} # No exceptions allowed in core cryptographic operations diff --git a/constantine/math/pairings/miller_loops.nim b/constantine/math/pairings/miller_loops.nim index c3e8ae40..8d29bff3 100644 --- a/constantine/math/pairings/miller_loops.nim +++ b/constantine/math/pairings/miller_loops.nim @@ -7,14 +7,14 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../../platforms/abstractions, - ../config/curves, - ../elliptic/[ + constantine/platforms/abstractions, + constantine/named/algebra, + constantine/math/elliptic/[ ec_shortweierstrass_affine, ec_shortweierstrass_projective ], - ../arithmetic, - ../isogenies/frobenius, + constantine/math/arithmetic, + constantine/math/isogenies/frobenius, ./lines_eval # No exceptions allowed @@ -394,4 +394,4 @@ func miller_accum_double_then_add*[FT, F1, F2]( f.mul_by_2_lines(lineOddRemainder0, lineOddRemainder1) else: if N.isOdd(): - f.mul_by_line(lineOddRemainder0) \ No newline at end of file + f.mul_by_line(lineOddRemainder0) diff --git a/constantine/math/pairings/pairings_bls12.nim b/constantine/math/pairings/pairings_bls12.nim index 16a13dc6..6f41610d 100644 --- a/constantine/math/pairings/pairings_bls12.nim +++ b/constantine/math/pairings/pairings_bls12.nim @@ -7,16 +7,16 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../../platforms/abstractions, - ../config/curves, - ../extension_fields, - ../elliptic/[ + constantine/platforms/abstractions, + constantine/named/algebra, + constantine/math/extension_fields, + constantine/math/elliptic/[ ec_shortweierstrass_affine, ec_shortweierstrass_projective ], - ../isogenies/frobenius, - ../constants/zoo_pairings, - ../arithmetic, + constantine/math/isogenies/frobenius, + constantine/named/zoo_pairings, + constantine/math/arithmetic, ./cyclotomic_subgroups, ./miller_loops diff --git a/constantine/math/pairings/pairings_bn.nim b/constantine/math/pairings/pairings_bn.nim index 9a2df4ac..68375f4a 100644 --- a/constantine/math/pairings/pairings_bn.nim +++ b/constantine/math/pairings/pairings_bn.nim @@ -7,15 +7,15 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../../platforms/abstractions, - ../config/curves, - ../extension_fields, - ../elliptic/[ + constantine/platforms/abstractions, + constantine/named/algebra, + constantine/math/extension_fields, + constantine/math/elliptic/[ ec_shortweierstrass_affine, ec_shortweierstrass_projective ], - ../isogenies/frobenius, - ../constants/zoo_pairings, + constantine/math/isogenies/frobenius, + constantine/named/zoo_pairings, ./cyclotomic_subgroups, ./miller_loops diff --git a/constantine/math/pairings/pairings_bw6_761.nim b/constantine/math/pairings/pairings_bw6_761.nim index bf88cd96..46658169 100644 --- a/constantine/math/pairings/pairings_bw6_761.nim +++ b/constantine/math/pairings/pairings_bw6_761.nim @@ -7,15 +7,15 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../config/curves, - ../arithmetic, - ../extension_fields, - ../elliptic/[ + constantine/named/algebra, + constantine/math/arithmetic, + constantine/math/extension_fields, + constantine/math/elliptic/[ ec_shortweierstrass_affine, ec_shortweierstrass_projective ], - ../isogenies/frobenius, - ../constants/zoo_pairings, + constantine/math/isogenies/frobenius, + constantine/named/zoo_pairings, ./lines_eval, ./miller_loops @@ -158,4 +158,4 @@ func pairing_bw6_761_reference*[C]( {.error: "BW6_761 Miller loop is not working yet".} gt.millerLoopBW6_761_naive(Q, P) gt.finalExpEasy() - gt.finalExpHard_BW6_761() \ No newline at end of file + gt.finalExpHard_BW6_761() diff --git a/constantine/math/pairings/pairings_generic.nim b/constantine/math/pairings/pairings_generic.nim index d1847e8d..f0d2f71e 100644 --- a/constantine/math/pairings/pairings_generic.nim +++ b/constantine/math/pairings/pairings_generic.nim @@ -7,11 +7,11 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../config/curves, + constantine/named/algebra, ./cyclotomic_subgroups, ./pairings_bn, ./pairings_bls12, - ../extension_fields, - ../constants/zoo_pairings + constantine/math/extension_fields, + constantine/named/zoo_pairings func pairing*[C](gt: var Fp12[C], P, Q: auto) {.inline.} = when family(C) == BarretoNaehrig: @@ -34,4 +34,4 @@ func finalExp*[C](gt: var Fp12[C]){.inline.} = elif family(C) == BarretoLynnScott: gt.finalExpHard_BLS12() else: - {.error: "Final Exponentiation not implemented for " & $C.} \ No newline at end of file + {.error: "Final Exponentiation not implemented for " & $C.} diff --git a/constantine/math/polynomials/fft.nim b/constantine/math/polynomials/fft.nim index 884f1453..8185f505 100644 --- a/constantine/math/polynomials/fft.nim +++ b/constantine/math/polynomials/fft.nim @@ -7,12 +7,12 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../config/curves, - ../arithmetic, - ../io/io_bigints, - ../ec_shortweierstrass, - ../elliptic/ec_scalar_mul_vartime, - ../../platforms/[abstractions, allocs, views] + constantine/named/algebra, + constantine/math/arithmetic, + constantine/math/io/io_bigints, + constantine/math/ec_shortweierstrass, + constantine/math/elliptic/ec_scalar_mul_vartime, + constantine/platforms/[abstractions, allocs, views] # ############################################################ # @@ -304,10 +304,10 @@ when isMainModule: import std/[times, monotimes, strformat], - ../../../helpers/prng_unsafe, - ../constants/zoo_generators, - ../io/[io_fields, io_ec], - ../../platforms/static_for + helpers/prng_unsafe, + constantine/named/zoo_generators, + constantine/math/io/[io_fields, io_ec], + constantine/platforms/static_for const ctt_eth_kzg_fr_pow2_roots_of_unity = [ # primitive_root⁽ᵐᵒᵈᵘˡᵘˢ⁻¹⁾/⁽²^ⁱ⁾ for i in [0, 32) diff --git a/constantine/math/polynomials/polynomials.nim b/constantine/math/polynomials/polynomials.nim index e6474451..e96aff49 100644 --- a/constantine/math/polynomials/polynomials.nim +++ b/constantine/math/polynomials/polynomials.nim @@ -7,10 +7,10 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../config/curves, - ../arithmetic, - ../io/io_fields, - ../../platforms/[allocs, bithacks, static_for] + constantine/named/algebra, + constantine/math/arithmetic, + constantine/math/io/io_fields, + constantine/platforms/[allocs, bithacks, static_for] ## ############################################################ ## diff --git a/constantine/math/polynomials/polynomials_parallel.nim b/constantine/math/polynomials/polynomials_parallel.nim index 36929f69..0e222e3e 100644 --- a/constantine/math/polynomials/polynomials_parallel.nim +++ b/constantine/math/polynomials/polynomials_parallel.nim @@ -10,9 +10,9 @@ import ./polynomials {.all.} export polynomials import - ../config/curves, - ../arithmetic, - ../../platforms/[allocs, bithacks], + constantine/named/algebra, + constantine/math/arithmetic, + constantine/platforms/[allocs, bithacks], ../../threadpool/threadpool ## ############################################################ diff --git a/constantine/math_arbitrary_precision/arithmetic/bigints_views.nim b/constantine/math_arbitrary_precision/arithmetic/bigints_views.nim index a70bd846..13561b5d 100644 --- a/constantine/math_arbitrary_precision/arithmetic/bigints_views.nim +++ b/constantine/math_arbitrary_precision/arithmetic/bigints_views.nim @@ -8,8 +8,8 @@ import # Internal - ../../platforms/[abstractions, allocs], - ../../math/config/precompute, + constantine/platforms/[abstractions, allocs], + constantine/named/deriv/precompute, ./limbs_views, ./limbs_montgomery, ./limbs_mod2k, diff --git a/constantine/math_arbitrary_precision/arithmetic/limbs_divmod.nim b/constantine/math_arbitrary_precision/arithmetic/limbs_divmod.nim index 4f31447d..4ab2ec93 100644 --- a/constantine/math_arbitrary_precision/arithmetic/limbs_divmod.nim +++ b/constantine/math_arbitrary_precision/arithmetic/limbs_divmod.nim @@ -7,7 +7,7 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../../platforms/abstractions, + constantine/platforms/abstractions, ./limbs_views, ./limbs_fixedprec diff --git a/constantine/math_arbitrary_precision/arithmetic/limbs_divmod_vartime.nim b/constantine/math_arbitrary_precision/arithmetic/limbs_divmod_vartime.nim index cf78f6bb..a48f98e9 100644 --- a/constantine/math_arbitrary_precision/arithmetic/limbs_divmod_vartime.nim +++ b/constantine/math_arbitrary_precision/arithmetic/limbs_divmod_vartime.nim @@ -7,8 +7,8 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../../platforms/abstractions, - ../../platforms/intrinsics/extended_precision_vartime, + constantine/platforms/abstractions, + constantine/platforms/intrinsics/extended_precision_vartime, ./limbs_views # No exceptions allowed diff --git a/constantine/math_arbitrary_precision/arithmetic/limbs_extmul.nim b/constantine/math_arbitrary_precision/arithmetic/limbs_extmul.nim index 96285e88..2a32e8bb 100644 --- a/constantine/math_arbitrary_precision/arithmetic/limbs_extmul.nim +++ b/constantine/math_arbitrary_precision/arithmetic/limbs_extmul.nim @@ -8,7 +8,7 @@ import # Internal - ../../platforms/[abstractions, allocs], + constantine/platforms/[abstractions, allocs], ./limbs_views func prod_comba(r: var openArray[SecretWord], a, b: openArray[SecretWord]) {.noInline, tags: [Alloca].} = @@ -101,4 +101,4 @@ func square_vartime*(r: var openArray[SecretWord], a: openArray[SecretWord]) {.i ## Extended precision squaring (vartime) let aBits = a.getBits_LE_vartime() let aWords = wordsRequired(aBits) - r.square_comba(a.toOpenArray(0, aWords-1)) \ No newline at end of file + r.square_comba(a.toOpenArray(0, aWords-1)) diff --git a/constantine/math_arbitrary_precision/arithmetic/limbs_fixedprec.nim b/constantine/math_arbitrary_precision/arithmetic/limbs_fixedprec.nim index 12f2ed8c..37b62265 100644 --- a/constantine/math_arbitrary_precision/arithmetic/limbs_fixedprec.nim +++ b/constantine/math_arbitrary_precision/arithmetic/limbs_fixedprec.nim @@ -7,7 +7,7 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../../platforms/abstractions, + constantine/platforms/abstractions, ./limbs_views # No exceptions allowed @@ -71,4 +71,4 @@ func csub*(a: LimbsViewMut, b: LimbsViewAny, ctl: SecretBool, len: int): Borrow var diff: SecretWord for i in 0 ..< len: subB(result, diff, a[i], b[i], result) - ctl.ccopy(a[i], diff) \ No newline at end of file + ctl.ccopy(a[i], diff) diff --git a/constantine/math_arbitrary_precision/arithmetic/limbs_mod.nim b/constantine/math_arbitrary_precision/arithmetic/limbs_mod.nim index fb82252b..6cebe820 100644 --- a/constantine/math_arbitrary_precision/arithmetic/limbs_mod.nim +++ b/constantine/math_arbitrary_precision/arithmetic/limbs_mod.nim @@ -8,7 +8,7 @@ import # Internal - ../../platforms/abstractions, + constantine/platforms/abstractions, ./limbs_multiprec # ############################################################ @@ -45,4 +45,4 @@ func addmod_vartime*(r: var openArray[SecretWord], a, b, M: openArray[SecretWord func doublemod_vartime*(r: var openArray[SecretWord], a, M: openArray[SecretWord]) {.inline, meter.} = ## r <- 2a (mod M) - r.addmod_vartime(a, a, M) \ No newline at end of file + r.addmod_vartime(a, a, M) diff --git a/constantine/math_arbitrary_precision/arithmetic/limbs_mod2k.nim b/constantine/math_arbitrary_precision/arithmetic/limbs_mod2k.nim index f06834b0..94bbee8a 100644 --- a/constantine/math_arbitrary_precision/arithmetic/limbs_mod2k.nim +++ b/constantine/math_arbitrary_precision/arithmetic/limbs_mod2k.nim @@ -8,8 +8,8 @@ import # Internal - ../../platforms/abstractions, - ../../math/arithmetic/limbs_exgcd, + constantine/platforms/abstractions, + constantine/math/arithmetic/limbs_exgcd, ./limbs_views, ./limbs_extmul, ./limbs_multiprec @@ -227,4 +227,4 @@ func invMod2k_vartime*(r: var openArray[SecretWord], a: openArray[SecretWord], k x.toOpenArray(0, r.len-1).mod2k_vartime(k) for i in 0 ..< r.len: - r[i] = x[i] \ No newline at end of file + r[i] = x[i] diff --git a/constantine/math_arbitrary_precision/arithmetic/limbs_montgomery.nim b/constantine/math_arbitrary_precision/arithmetic/limbs_montgomery.nim index 05f85fab..bf24eb6c 100644 --- a/constantine/math_arbitrary_precision/arithmetic/limbs_montgomery.nim +++ b/constantine/math_arbitrary_precision/arithmetic/limbs_montgomery.nim @@ -8,7 +8,7 @@ import # Internal - ../../platforms/[abstractions, allocs, bithacks], + constantine/platforms/[abstractions, allocs, bithacks], ./limbs_views, ./limbs_multiprec, ./limbs_fixedprec, @@ -443,4 +443,4 @@ func powMont_vartime*( s0.mulMont_FIPS(a, s1, M, m0ninv, mBits) a.copyWords(0, s0, 0, N) -{.pop.} \ No newline at end of file +{.pop.} diff --git a/constantine/math_arbitrary_precision/arithmetic/limbs_multiprec.nim b/constantine/math_arbitrary_precision/arithmetic/limbs_multiprec.nim index d4a193e5..cdc4af2f 100644 --- a/constantine/math_arbitrary_precision/arithmetic/limbs_multiprec.nim +++ b/constantine/math_arbitrary_precision/arithmetic/limbs_multiprec.nim @@ -8,7 +8,7 @@ import # Internal - ../../platforms/abstractions + constantine/platforms/abstractions # ############################################################ # @@ -225,4 +225,4 @@ func subMP*(r {.noAlias.}: var openArray[SecretWord], a, b: openArray[SecretWord # if a < b, borrow, we store the 2-complement, mask = -1 let mask = Zero - SecretWord(borrow) for i in maxLen ..< r.len: - r[i] = mask \ No newline at end of file + r[i] = mask diff --git a/constantine/math_arbitrary_precision/arithmetic/limbs_views.nim b/constantine/math_arbitrary_precision/arithmetic/limbs_views.nim index 34422581..b58ff42b 100644 --- a/constantine/math_arbitrary_precision/arithmetic/limbs_views.nim +++ b/constantine/math_arbitrary_precision/arithmetic/limbs_views.nim @@ -6,7 +6,7 @@ # * Apache v2 license (license terms in the root directory or at http://www.apache.org/licenses/LICENSE-2.0). # at your option. This file may not be copied, modified, or distributed except according to those terms. -import ../../platforms/abstractions +import constantine/platforms/abstractions # No exceptions allowed {.push raises: [].} diff --git a/constantine/math_codegen/fields_nvidia.nim b/constantine/math_compiler/fields_nvidia.nim similarity index 100% rename from constantine/math_codegen/fields_nvidia.nim rename to constantine/math_compiler/fields_nvidia.nim diff --git a/constantine/named/README.md b/constantine/named/README.md new file mode 100644 index 00000000..bfd81637 --- /dev/null +++ b/constantine/named/README.md @@ -0,0 +1,3 @@ +# Named Algebra + +This folder holds named fields and named curves configuration and precomputed constants. diff --git a/constantine/math/config/curves.nim b/constantine/named/algebra.nim similarity index 76% rename from constantine/math/config/curves.nim rename to constantine/named/algebra.nim index 08075286..b203391a 100644 --- a/constantine/math/config/curves.nim +++ b/constantine/named/algebra.nim @@ -6,5 +6,5 @@ # * Apache v2 license (license terms in the root directory or at http://www.apache.org/licenses/LICENSE-2.0). # at your option. This file may not be copied, modified, or distributed except according to those terms. -import curves_prop_field_core, curves_prop_field_derived, curves_prop_curve -export curves_prop_field_core, curves_prop_field_derived, curves_prop_curve +import properties_fields, properties_curves +export properties_fields, properties_curves diff --git a/constantine/math/config/curves_declaration.nim b/constantine/named/config_fields_and_curves.nim similarity index 98% rename from constantine/math/config/curves_declaration.nim rename to constantine/named/config_fields_and_curves.nim index d4da2925..6ee2ff96 100644 --- a/constantine/math/config/curves_declaration.nim +++ b/constantine/named/config_fields_and_curves.nim @@ -8,13 +8,14 @@ import # Internal - ./curves_parser_field + ./deriv/parser_fields export CurveFamily, SexticTwist # ############################################################ # -# Configuration of finite fields +# Configuration of named algebraic objects +# finite fields and elliptic curves # # ############################################################ diff --git a/constantine/math/constants/README.md b/constantine/named/constants/README.md similarity index 100% rename from constantine/math/constants/README.md rename to constantine/named/constants/README.md diff --git a/constantine/math/constants/bandersnatch_generators.nim b/constantine/named/constants/bandersnatch_generators.nim similarity index 87% rename from constantine/math/constants/bandersnatch_generators.nim rename to constantine/named/constants/bandersnatch_generators.nim index 1e8b1601..f7a2903c 100644 --- a/constantine/math/constants/bandersnatch_generators.nim +++ b/constantine/named/constants/bandersnatch_generators.nim @@ -7,9 +7,9 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../config/curves, - ../elliptic/ec_twistededwards_affine, - ../io/[io_fields, io_extfields] + constantine/named/algebra, + constantine/math/elliptic/ec_twistededwards_affine, + constantine/math/io/[io_fields, io_extfields] {.used.} @@ -20,4 +20,4 @@ import const Bandersnatch_generator* = ECP_TwEdwards_Aff[Fp[Bandersnatch]]( x: Fp[Bandersnatch].fromHex"0x29c132cc2c0b34c5743711777bbe42f32b79c022ad998465e1e71866a252ae18", y: Fp[Bandersnatch].fromHex"0x2a6c669eda123e0f157d8b50badcd586358cad81eee464605e3167b6cc974166" -) \ No newline at end of file +) diff --git a/constantine/math/constants/bandersnatch_sqrt.nim b/constantine/named/constants/bandersnatch_sqrt.nim similarity index 99% rename from constantine/math/constants/bandersnatch_sqrt.nim rename to constantine/named/constants/bandersnatch_sqrt.nim index a1084fba..da0fbccf 100644 --- a/constantine/math/constants/bandersnatch_sqrt.nim +++ b/constantine/named/constants/bandersnatch_sqrt.nim @@ -6,9 +6,9 @@ import std/tables, - ../config/curves, - ../io/[io_bigints, io_fields], - ../arithmetic/finite_fields + constantine/named/algebra, + constantine/math/io/[io_bigints, io_fields], + constantine/math/arithmetic/finite_fields const # with e = 2adicity diff --git a/constantine/math/constants/bandersnatch_subgroups.nim b/constantine/named/constants/bandersnatch_subgroups.nim similarity index 92% rename from constantine/math/constants/bandersnatch_subgroups.nim rename to constantine/named/constants/bandersnatch_subgroups.nim index 50af38da..112bd352 100644 --- a/constantine/math/constants/bandersnatch_subgroups.nim +++ b/constantine/named/constants/bandersnatch_subgroups.nim @@ -8,9 +8,9 @@ import # Internals - ../config/curves, - ../arithmetic, - ../elliptic/ec_twistededwards_projective + constantine/named/algebra, + constantine/math/arithmetic, + constantine/math/elliptic/ec_twistededwards_projective # ############################################################ # diff --git a/constantine/math/constants/banderwagon_generators.nim b/constantine/named/constants/banderwagon_generators.nim similarity index 87% rename from constantine/math/constants/banderwagon_generators.nim rename to constantine/named/constants/banderwagon_generators.nim index 609bfbd6..c3bb559e 100644 --- a/constantine/math/constants/banderwagon_generators.nim +++ b/constantine/named/constants/banderwagon_generators.nim @@ -7,9 +7,9 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../config/curves, - ../elliptic/ec_twistededwards_affine, - ../io/[io_fields, io_extfields] + constantine/named/algebra, + constantine/math/elliptic/ec_twistededwards_affine, + constantine/math/io/[io_fields, io_extfields] {.used.} @@ -20,4 +20,4 @@ import const Banderwagon_generator* = ECP_TwEdwards_Aff[Fp[Banderwagon]]( x: Fp[Banderwagon].fromHex("29c132cc2c0b34c5743711777bbe42f32b79c022ad998465e1e71866a252ae18"), y: Fp[Banderwagon].fromHex("2a6c669eda123e0f157d8b50badcd586358cad81eee464605e3167b6cc974166") -) \ No newline at end of file +) diff --git a/constantine/math/constants/banderwagon_sqrt.nim b/constantine/named/constants/banderwagon_sqrt.nim similarity index 99% rename from constantine/math/constants/banderwagon_sqrt.nim rename to constantine/named/constants/banderwagon_sqrt.nim index f69a1397..08b8db3c 100644 --- a/constantine/math/constants/banderwagon_sqrt.nim +++ b/constantine/named/constants/banderwagon_sqrt.nim @@ -6,9 +6,9 @@ import std/tables, - ../config/curves, - ../io/[io_bigints, io_fields], - ../arithmetic/finite_fields + constantine/named/algebra, + constantine/math/io/[io_bigints, io_fields], + constantine/math/arithmetic/finite_fields const # with e = 2adicity @@ -158,10 +158,10 @@ func precompute_tonelli_shanks_addchain*( r *= a -# ############################################################ -# -# Optimized square-root via Discrete Log lookup tables -# +# ############################################################ +# +# Optimized square-root via Discrete Log lookup tables +# # ############################################################ const @@ -1505,4 +1505,3 @@ const Fp[Banderwagon].fromHex"0x18ba7658084c71a467e701a945e9b713df7b4ee66e4caccb7d01866add958780" ] ] - diff --git a/constantine/math/constants/banderwagon_subgroups.nim b/constantine/named/constants/banderwagon_subgroups.nim similarity index 87% rename from constantine/math/constants/banderwagon_subgroups.nim rename to constantine/named/constants/banderwagon_subgroups.nim index 20d28ee9..b6328f16 100644 --- a/constantine/math/constants/banderwagon_subgroups.nim +++ b/constantine/named/constants/banderwagon_subgroups.nim @@ -7,11 +7,11 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../../platforms/abstractions, - ../config/curves, - ../arithmetic, - ../extension_fields, - ../elliptic/ec_twistededwards_affine + constantine/platforms/abstractions, + constantine/named/algebra, + constantine/math/arithmetic, + constantine/math/extension_fields, + constantine/math/elliptic/ec_twistededwards_affine # ############################################################ # diff --git a/constantine/math/constants/bls12_377_constants.nim b/constantine/named/constants/bls12_377_constants.nim similarity index 82% rename from constantine/math/constants/bls12_377_constants.nim rename to constantine/named/constants/bls12_377_constants.nim index fb66a9d5..e5d6ab09 100644 --- a/constantine/math/constants/bls12_377_constants.nim +++ b/constantine/named/constants/bls12_377_constants.nim @@ -7,18 +7,18 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../config/curves, - ../io/io_extfields + constantine/named/algebra, + constantine/math/io/io_extfields {.used.} # Curve precomputed parameters # ----------------------------------------------------------------- -const BLS12_377_coefB_G2* = Fp2[BLS12_377].fromHex( +const BLS12_377_coefB_G2* = Fp2[BLS12_377].fromHex( "0x0", "0x10222f6db0fd6f343bd03737460c589dc7b4f91cd5fd889129207b63c6bf8000dd39e5c1ccccccd1c9ed9999999999a" ) -const BLS12_377_coefB_G2_times_3* = Fp2[BLS12_377].fromHex( +const BLS12_377_coefB_G2_times_3* = Fp2[BLS12_377].fromHex( "0x0", "0x1582e9e796a73ef04fc0499f08107627b4f14c2672a760c18c2b4f2fb3aa000126f7dd026666666d0d3cccccccccccd" ) diff --git a/constantine/math/constants/bls12_377_endomorphisms.nim b/constantine/named/constants/bls12_377_endomorphisms.nim similarity index 96% rename from constantine/math/constants/bls12_377_endomorphisms.nim rename to constantine/named/constants/bls12_377_endomorphisms.nim index 05c856e0..f6d3c1cf 100644 --- a/constantine/math/constants/bls12_377_endomorphisms.nim +++ b/constantine/named/constants/bls12_377_endomorphisms.nim @@ -7,8 +7,8 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../config/curves, - ../io/[io_bigints, io_fields] + constantine/named/algebra, + constantine/math/io/[io_bigints, io_fields] {.used.} diff --git a/constantine/math/constants/bls12_377_frobenius.nim b/constantine/named/constants/bls12_377_frobenius.nim similarity index 98% rename from constantine/math/constants/bls12_377_frobenius.nim rename to constantine/named/constants/bls12_377_frobenius.nim index 7aedb978..e21948a0 100644 --- a/constantine/math/constants/bls12_377_frobenius.nim +++ b/constantine/named/constants/bls12_377_frobenius.nim @@ -7,9 +7,9 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../config/curves, - ../extension_fields, - ../io/io_extfields + constantine/named/algebra, + constantine/math/extension_fields, + constantine/math/io/io_extfields {.used.} diff --git a/constantine/math/constants/bls12_377_pairings.nim b/constantine/named/constants/bls12_377_pairings.nim similarity index 93% rename from constantine/math/constants/bls12_377_pairings.nim rename to constantine/named/constants/bls12_377_pairings.nim index 2088a9d9..18ece596 100644 --- a/constantine/math/constants/bls12_377_pairings.nim +++ b/constantine/named/constants/bls12_377_pairings.nim @@ -7,13 +7,13 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../../platforms/abstractions, - ../config/curves, - ../io/io_bigints, - ../extension_fields, - ../elliptic/[ec_shortweierstrass_affine, ec_shortweierstrass_projective], - ../pairings/[cyclotomic_subgroups, miller_loops], - ../isogenies/frobenius + constantine/platforms/abstractions, + constantine/named/algebra, + constantine/math/io/io_bigints, + constantine/math/extension_fields, + constantine/math/elliptic/[ec_shortweierstrass_affine, ec_shortweierstrass_projective], + constantine/math/pairings/[cyclotomic_subgroups, miller_loops], + constantine/math/isogenies/frobenius # Slow generic implementation # ------------------------------------------------------------ @@ -106,4 +106,4 @@ func isInPairingSubgroup*(a: Fp12[BLS12_377]): SecretBool = t0.frobenius_map(a) t1.cycl_exp_by_curve_param(a) - return t0 == t1 \ No newline at end of file + return t0 == t1 diff --git a/constantine/math/constants/bls12_377_sqrt.nim b/constantine/named/constants/bls12_377_sqrt.nim similarity index 97% rename from constantine/math/constants/bls12_377_sqrt.nim rename to constantine/named/constants/bls12_377_sqrt.nim index a670644b..db454f60 100644 --- a/constantine/math/constants/bls12_377_sqrt.nim +++ b/constantine/named/constants/bls12_377_sqrt.nim @@ -7,9 +7,9 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../config/curves, - ../io/[io_bigints, io_fields], - ../arithmetic/finite_fields + constantine/named/algebra, + constantine/math/io/[io_bigints, io_fields], + constantine/math/arithmetic/finite_fields const # with e = 2adicity diff --git a/constantine/math/constants/bls12_377_subgroups.nim b/constantine/named/constants/bls12_377_subgroups.nim similarity index 96% rename from constantine/math/constants/bls12_377_subgroups.nim rename to constantine/named/constants/bls12_377_subgroups.nim index 0a013b36..2d29b749 100644 --- a/constantine/math/constants/bls12_377_subgroups.nim +++ b/constantine/named/constants/bls12_377_subgroups.nim @@ -8,14 +8,14 @@ import # Internals - ../../platforms/abstractions, - ../config/curves, - ../arithmetic, - ../extension_fields, - ../ec_shortweierstrass, - ../io/io_bigints, - ../isogenies/frobenius, - ../constants/zoo_endomorphisms + constantine/platforms/abstractions, + constantine/named/algebra, + constantine/math/arithmetic, + constantine/math/extension_fields, + constantine/math/ec_shortweierstrass, + constantine/math/io/io_bigints, + constantine/math/isogenies/frobenius, + constantine/named/zoo_endomorphisms func pow_bls12_377_abs_x[ECP: ECP_ShortW[Fp[BLS12_377], G1] or ECP_ShortW[Fp2[BLS12_377], G2]]( @@ -230,4 +230,4 @@ func isInSubgroup*(P: ECP_ShortW_Aff[Fp2[BLS12_377], G2]): SecretBool = ## Warning ⚠: Assumes that P is on curve var t{.noInit.}: ECP_ShortW_Jac[Fp2[BLS12_377], G2] t.fromAffine(P) - return t.isInSubgroup() \ No newline at end of file + return t.isInSubgroup() diff --git a/constantine/math/constants/bls12_381_constants.nim b/constantine/named/constants/bls12_381_constants.nim similarity index 78% rename from constantine/math/constants/bls12_381_constants.nim rename to constantine/named/constants/bls12_381_constants.nim index 0dea433a..877b3161 100644 --- a/constantine/math/constants/bls12_381_constants.nim +++ b/constantine/named/constants/bls12_381_constants.nim @@ -7,18 +7,18 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../config/curves, - ../io/io_extfields + constantine/named/algebra, + constantine/math/io/io_extfields {.used.} # Curve precomputed parameters # ----------------------------------------------------------------- -const BLS12_381_coefB_G2* = Fp2[BLS12_381].fromHex( +const BLS12_381_coefB_G2* = Fp2[BLS12_381].fromHex( "0x4", "0x4" ) -const BLS12_381_coefB_G2_times_3* = Fp2[BLS12_381].fromHex( +const BLS12_381_coefB_G2_times_3* = Fp2[BLS12_381].fromHex( "0xc", "0xc" ) diff --git a/constantine/math/constants/bls12_381_endomorphisms.nim b/constantine/named/constants/bls12_381_endomorphisms.nim similarity index 96% rename from constantine/math/constants/bls12_381_endomorphisms.nim rename to constantine/named/constants/bls12_381_endomorphisms.nim index 8139f348..4195054a 100644 --- a/constantine/math/constants/bls12_381_endomorphisms.nim +++ b/constantine/named/constants/bls12_381_endomorphisms.nim @@ -7,8 +7,8 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../config/curves, - ../io/[io_bigints, io_fields] + constantine/named/algebra, + constantine/math/io/[io_bigints, io_fields] {.used.} diff --git a/constantine/math/constants/bls12_381_frobenius.nim b/constantine/named/constants/bls12_381_frobenius.nim similarity index 98% rename from constantine/math/constants/bls12_381_frobenius.nim rename to constantine/named/constants/bls12_381_frobenius.nim index e970c9f1..1cfe555b 100644 --- a/constantine/math/constants/bls12_381_frobenius.nim +++ b/constantine/named/constants/bls12_381_frobenius.nim @@ -7,9 +7,9 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../config/curves, - ../extension_fields, - ../io/io_extfields + constantine/named/algebra, + constantine/math/extension_fields, + constantine/math/io/io_extfields {.used.} diff --git a/constantine/math/constants/bls12_381_generators.nim b/constantine/named/constants/bls12_381_generators.nim similarity index 92% rename from constantine/math/constants/bls12_381_generators.nim rename to constantine/named/constants/bls12_381_generators.nim index 66737378..968e38f5 100644 --- a/constantine/math/constants/bls12_381_generators.nim +++ b/constantine/named/constants/bls12_381_generators.nim @@ -7,9 +7,9 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../config/curves, - ../elliptic/ec_shortweierstrass_affine, - ../io/[io_fields, io_extfields] + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_affine, + constantine/math/io/[io_fields, io_extfields] {.used.} diff --git a/constantine/math/constants/bls12_381_hash_to_curve_g1.nim b/constantine/named/constants/bls12_381_hash_to_curve_g1.nim similarity index 95% rename from constantine/math/constants/bls12_381_hash_to_curve_g1.nim rename to constantine/named/constants/bls12_381_hash_to_curve_g1.nim index 3e1dea89..1e78c7b1 100644 --- a/constantine/math/constants/bls12_381_hash_to_curve_g1.nim +++ b/constantine/named/constants/bls12_381_hash_to_curve_g1.nim @@ -7,8 +7,8 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../config/curves, - ../io/io_fields + constantine/named/algebra, + constantine/math/io/io_fields {.used.} @@ -16,17 +16,17 @@ import # ----------------------------------------------------------------- # Spec: # - https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-hash-to-curve-14#appendix-F.1 -# This map is slower than SSWU +# This map is slower than SSWU -const BLS12_381_h2c_svdw_G1_Z* = Fp[BLS12_381].fromHex( +const BLS12_381_h2c_svdw_G1_Z* = Fp[BLS12_381].fromHex( "0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaa8") -const BLS12_381_h2c_svdw_G1_curve_eq_rhs_Z* = Fp[BLS12_381].fromHex( +const BLS12_381_h2c_svdw_G1_curve_eq_rhs_Z* = Fp[BLS12_381].fromHex( "0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaa94") -const BLS12_381_h2c_svdw_G1_minus_Z_div_2* = Fp[BLS12_381].fromHex( +const BLS12_381_h2c_svdw_G1_minus_Z_div_2* = Fp[BLS12_381].fromHex( "0xd0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9ffffdcff7fffffffd557") -const BLS12_381_h2c_svdw_G1_z3* = Fp[BLS12_381].fromHex( +const BLS12_381_h2c_svdw_G1_z3* = Fp[BLS12_381].fromHex( "0xc855b97020fc106fa9c2de78c9f5d835bbc17c0487afe401c9cd0dcff9fd40bdf8033cd3095a4cd124d794808f153aa") -const BLS12_381_h2c_svdw_G1_z4* = Fp[BLS12_381].fromHex( +const BLS12_381_h2c_svdw_G1_z4* = Fp[BLS12_381].fromHex( "0x6bde8333e50911e85400f0953d13fc61090b4c3a76e5a319f7e6f7f108cb197962c97b3cf28bda11d421c71c71c5bab") # Hash-to-Curve Simplified Shallue-van de Woestijne-Ulas (SSWU) map @@ -41,17 +41,17 @@ const BLS12_381_h2c_svdw_G1_z4* = Fp[BLS12_381].fromHex( # - https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-hash-to-curve-14#section-8.8.2 # - https://github.com/cfrg/draft-irtf-cfrg-hash-to-curve/blob/f7dd3761/poc/sswu_opt_3mod4.sage#L126-L132 -const BLS12_381_h2c_sswu_G1_Aprime_E1* = Fp[BLS12_381].fromHex( +const BLS12_381_h2c_sswu_G1_Aprime_E1* = Fp[BLS12_381].fromHex( "0x144698a3b8e9433d693a02c96d4982b0ea985383ee66a8d8e8981aefd881ac98936f8da0e0f97f5cf428082d584c1d") -const BLS12_381_h2c_sswu_G1_Bprime_E1* = Fp[BLS12_381].fromHex( +const BLS12_381_h2c_sswu_G1_Bprime_E1* = Fp[BLS12_381].fromHex( "0x12e2908d11688030018b12e8753eee3b2016c1f0f24f4070a0b9c14fcef35ef55a23215a316ceaa5d1cc48e98e172be0") -const BLS12_381_h2c_sswu_G1_Z* = Fp[BLS12_381].fromHex( +const BLS12_381_h2c_sswu_G1_Z* = Fp[BLS12_381].fromHex( "0xb") -const BLS12_381_h2c_sswu_G1_minus_A* = Fp[BLS12_381].fromHex( +const BLS12_381_h2c_sswu_G1_minus_A* = Fp[BLS12_381].fromHex( "0x19eccb5195c6fd570db26db379de6354b38cb3316f96ac168e483a8606d8747786189071107306805d0ad7f7d2a75e8e") -const BLS12_381_h2c_sswu_G1_ZmulA* = Fp[BLS12_381].fromHex( +const BLS12_381_h2c_sswu_G1_ZmulA* = Fp[BLS12_381].fromHex( "0xdf088f08f205e3a3857e1ea7b2289d9a148b96ab3e694151fe89284e4d926a8e55cb15e9aab878fe7db859f2cb453f") -const BLS12_381_h2c_sswu_G1_sqrt_minus_Z3* = Fp[BLS12_381].fromHex( +const BLS12_381_h2c_sswu_G1_sqrt_minus_Z3* = Fp[BLS12_381].fromHex( "0x3d689d1e0e762cef9f2bec6130316806b4c80eda6fc10ce77ae83eab1ea8b8b8a407c9c6db195e06f2dbeabc2baeff5") # Hash-to-Curve 11-isogeny map BLS12-381 E'1 constants diff --git a/constantine/math/constants/bls12_381_hash_to_curve_g2.nim b/constantine/named/constants/bls12_381_hash_to_curve_g2.nim similarity index 96% rename from constantine/math/constants/bls12_381_hash_to_curve_g2.nim rename to constantine/named/constants/bls12_381_hash_to_curve_g2.nim index af2c82b0..76d8444c 100644 --- a/constantine/math/constants/bls12_381_hash_to_curve_g2.nim +++ b/constantine/named/constants/bls12_381_hash_to_curve_g2.nim @@ -7,8 +7,8 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../config/curves, - ../io/[io_fields, io_extfields] + constantine/named/algebra, + constantine/math/io/[io_fields, io_extfields] {.used.} @@ -16,25 +16,25 @@ import # ----------------------------------------------------------------- # Spec: # - https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-hash-to-curve-14#appendix-F.1 -# This map is slower than SSWU +# This map is slower than SSWU -const BLS12_381_h2c_svdw_G2_Z* = Fp2[BLS12_381].fromHex( +const BLS12_381_h2c_svdw_G2_Z* = Fp2[BLS12_381].fromHex( "0x0", "0x1" ) -const BLS12_381_h2c_svdw_G2_curve_eq_rhs_Z* = Fp2[BLS12_381].fromHex( +const BLS12_381_h2c_svdw_G2_curve_eq_rhs_Z* = Fp2[BLS12_381].fromHex( "0x4", "0x3" ) -const BLS12_381_h2c_svdw_G2_minus_Z_div_2* = Fp2[BLS12_381].fromHex( +const BLS12_381_h2c_svdw_G2_minus_Z_div_2* = Fp2[BLS12_381].fromHex( "0x0", "0xd0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9ffffdcff7fffffffd555" ) -const BLS12_381_h2c_svdw_G2_z3* = Fp2[BLS12_381].fromHex( +const BLS12_381_h2c_svdw_G2_z3* = Fp2[BLS12_381].fromHex( "0xbdd5ce0da1f67a74801737ad294eb2e8792dfaff3b97d438795e114a0bf9b0d448554f8291ae6ae6f9aad7ac97e0842", "0x154a803c6f0a66f3f4bd964d1db96c49c5807ce89e413640c752821cda0b2d1c809f1c51d940f78f4bdd8f28edd47488" ) -const BLS12_381_h2c_svdw_G2_z4* = Fp2[BLS12_381].fromHex( +const BLS12_381_h2c_svdw_G2_z4* = Fp2[BLS12_381].fromHex( "0x11560bf17baa99bc32126fced787c88f984f87adf7ae0c7f9a208c6b4f20a4181472aaa9cb8d555526a9ffffffffc722", "0x4" ) diff --git a/constantine/math/constants/bls12_381_pairings.nim b/constantine/named/constants/bls12_381_pairings.nim similarity index 94% rename from constantine/math/constants/bls12_381_pairings.nim rename to constantine/named/constants/bls12_381_pairings.nim index a90e43c9..8454a5f5 100644 --- a/constantine/math/constants/bls12_381_pairings.nim +++ b/constantine/named/constants/bls12_381_pairings.nim @@ -7,13 +7,13 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../../platforms/abstractions, - ../config/curves, - ../io/io_bigints, - ../extension_fields, - ../elliptic/[ec_shortweierstrass_affine, ec_shortweierstrass_projective], - ../pairings/[cyclotomic_subgroups, miller_loops], - ../isogenies/frobenius + constantine/platforms/abstractions, + constantine/named/algebra, + constantine/math/io/io_bigints, + constantine/math/extension_fields, + constantine/math/elliptic/[ec_shortweierstrass_affine, ec_shortweierstrass_projective], + constantine/math/pairings/[cyclotomic_subgroups, miller_loops], + constantine/math/isogenies/frobenius # Slow generic implementation # ------------------------------------------------------------ @@ -132,4 +132,4 @@ func isInPairingSubgroup*(a: Fp12[BLS12_381]): SecretBool {.meter.} = t0.frobenius_map(a) t1.cycl_exp_by_curve_param(a) - return t0 == t1 \ No newline at end of file + return t0 == t1 diff --git a/constantine/math/constants/bls12_381_sqrt.nim b/constantine/named/constants/bls12_381_sqrt.nim similarity index 98% rename from constantine/math/constants/bls12_381_sqrt.nim rename to constantine/named/constants/bls12_381_sqrt.nim index b6f50ce1..bc94c3e2 100644 --- a/constantine/math/constants/bls12_381_sqrt.nim +++ b/constantine/named/constants/bls12_381_sqrt.nim @@ -7,8 +7,8 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../config/curves, - ../arithmetic/finite_fields + constantine/named/algebra, + constantine/math/arithmetic/finite_fields # ############################################################ # diff --git a/constantine/math/constants/bls12_381_sqrt_fp2.nim b/constantine/named/constants/bls12_381_sqrt_fp2.nim similarity index 95% rename from constantine/math/constants/bls12_381_sqrt_fp2.nim rename to constantine/named/constants/bls12_381_sqrt_fp2.nim index 28ebb919..cd4c56ee 100644 --- a/constantine/math/constants/bls12_381_sqrt_fp2.nim +++ b/constantine/named/constants/bls12_381_sqrt_fp2.nim @@ -7,8 +7,8 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../config/curves, - ../io/io_extfields + constantine/named/algebra, + constantine/math/io/io_extfields {.used.} diff --git a/constantine/math/constants/bls12_381_subgroups.nim b/constantine/named/constants/bls12_381_subgroups.nim similarity index 96% rename from constantine/math/constants/bls12_381_subgroups.nim rename to constantine/named/constants/bls12_381_subgroups.nim index 040be759..416b9e83 100644 --- a/constantine/math/constants/bls12_381_subgroups.nim +++ b/constantine/named/constants/bls12_381_subgroups.nim @@ -8,14 +8,14 @@ import # Internals - ../../platforms/abstractions, - ../config/curves, - ../arithmetic, - ../extension_fields, - ../ec_shortweierstrass, - ../io/io_bigints, - ../isogenies/frobenius, - ../constants/zoo_endomorphisms + constantine/platforms/abstractions, + constantine/named/algebra, + constantine/math/arithmetic, + constantine/math/extension_fields, + constantine/math/ec_shortweierstrass, + constantine/math/io/io_bigints, + constantine/math/isogenies/frobenius, + constantine/named/zoo_endomorphisms func pow_bls12_381_abs_x[ECP: ECP_ShortW[Fp[BLS12_381], G1] or ECP_ShortW[Fp2[BLS12_381], G2]]( @@ -224,4 +224,4 @@ func isInSubgroup*(P: ECP_ShortW_Aff[Fp2[BLS12_381], G2]): SecretBool = ## Warning ⚠: Assumes that P is on curve var t{.noInit.}: ECP_ShortW_Jac[Fp2[BLS12_381], G2] t.fromAffine(P) - return t.isInSubgroup() \ No newline at end of file + return t.isInSubgroup() diff --git a/constantine/math/constants/bn254_nogami_constants.nim b/constantine/named/constants/bn254_nogami_constants.nim similarity index 87% rename from constantine/math/constants/bn254_nogami_constants.nim rename to constantine/named/constants/bn254_nogami_constants.nim index ab2c44f9..c4150c4e 100644 --- a/constantine/math/constants/bn254_nogami_constants.nim +++ b/constantine/named/constants/bn254_nogami_constants.nim @@ -7,18 +7,18 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../config/curves, - ../io/io_extfields + constantine/named/algebra, + constantine/math/io/io_extfields {.used.} # Curve precomputed parameters # ----------------------------------------------------------------- -const BN254_Nogami_coefB_G2* = Fp2[BN254_Nogami].fromHex( +const BN254_Nogami_coefB_G2* = Fp2[BN254_Nogami].fromHex( "0x1", "0x2523648240000001ba344d80000000086121000000000013a700000000000012" ) -const BN254_Nogami_coefB_G2_times_3* = Fp2[BN254_Nogami].fromHex( +const BN254_Nogami_coefB_G2_times_3* = Fp2[BN254_Nogami].fromHex( "0x3", "0x2523648240000001ba344d80000000086121000000000013a700000000000010" ) diff --git a/constantine/math/constants/bn254_nogami_endomorphisms.nim b/constantine/named/constants/bn254_nogami_endomorphisms.nim similarity index 97% rename from constantine/math/constants/bn254_nogami_endomorphisms.nim rename to constantine/named/constants/bn254_nogami_endomorphisms.nim index 64a3418a..4d871ec3 100644 --- a/constantine/math/constants/bn254_nogami_endomorphisms.nim +++ b/constantine/named/constants/bn254_nogami_endomorphisms.nim @@ -7,8 +7,8 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../config/curves, - ../io/[io_bigints, io_fields] + constantine/named/algebra, + constantine/math/io/[io_bigints, io_fields] {.used.} diff --git a/constantine/math/constants/bn254_nogami_frobenius.nim b/constantine/named/constants/bn254_nogami_frobenius.nim similarity index 98% rename from constantine/math/constants/bn254_nogami_frobenius.nim rename to constantine/named/constants/bn254_nogami_frobenius.nim index 11548fef..a49765f5 100644 --- a/constantine/math/constants/bn254_nogami_frobenius.nim +++ b/constantine/named/constants/bn254_nogami_frobenius.nim @@ -7,9 +7,9 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../config/curves, - ../extension_fields, - ../io/io_extfields + constantine/named/algebra, + constantine/math/extension_fields, + constantine/math/io/io_extfields {.used.} diff --git a/constantine/math/constants/bn254_nogami_pairings.nim b/constantine/named/constants/bn254_nogami_pairings.nim similarity index 93% rename from constantine/math/constants/bn254_nogami_pairings.nim rename to constantine/named/constants/bn254_nogami_pairings.nim index a273665e..63d27af7 100644 --- a/constantine/math/constants/bn254_nogami_pairings.nim +++ b/constantine/named/constants/bn254_nogami_pairings.nim @@ -7,13 +7,13 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../../platforms/abstractions, - ../config/curves, - ../io/io_bigints, - ../extension_fields, - ../elliptic/[ec_shortweierstrass_affine, ec_shortweierstrass_projective], - ../pairings/[cyclotomic_subgroups, miller_loops], - ../isogenies/frobenius + constantine/platforms/abstractions, + constantine/named/algebra, + constantine/math/io/io_bigints, + constantine/math/extension_fields, + constantine/math/elliptic/[ec_shortweierstrass_affine, ec_shortweierstrass_projective], + constantine/math/pairings/[cyclotomic_subgroups, miller_loops], + constantine/math/isogenies/frobenius # Slow generic implementation # ------------------------------------------------------------ @@ -110,4 +110,4 @@ func isInPairingSubgroup*(a: Fp12[BN254_Nogami]): SecretBool = t1.frobenius_map(a) - return t0 == t1 \ No newline at end of file + return t0 == t1 diff --git a/constantine/math/constants/bn254_nogami_sqrt.nim b/constantine/named/constants/bn254_nogami_sqrt.nim similarity index 96% rename from constantine/math/constants/bn254_nogami_sqrt.nim rename to constantine/named/constants/bn254_nogami_sqrt.nim index 7454c723..d11de9ca 100644 --- a/constantine/math/constants/bn254_nogami_sqrt.nim +++ b/constantine/named/constants/bn254_nogami_sqrt.nim @@ -7,8 +7,8 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../config/curves, - ../arithmetic/finite_fields + constantine/named/algebra, + constantine/math/arithmetic/finite_fields # ############################################################ # diff --git a/constantine/math/constants/bn254_nogami_sqrt_fp2.nim b/constantine/named/constants/bn254_nogami_sqrt_fp2.nim similarity index 94% rename from constantine/math/constants/bn254_nogami_sqrt_fp2.nim rename to constantine/named/constants/bn254_nogami_sqrt_fp2.nim index 6741ac61..f9dd16bc 100644 --- a/constantine/math/constants/bn254_nogami_sqrt_fp2.nim +++ b/constantine/named/constants/bn254_nogami_sqrt_fp2.nim @@ -7,8 +7,8 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../config/curves, - ../io/io_extfields + constantine/named/algebra, + constantine/math/io/io_extfields {.used.} diff --git a/constantine/math/constants/bn254_nogami_subgroups.nim b/constantine/named/constants/bn254_nogami_subgroups.nim similarity index 94% rename from constantine/math/constants/bn254_nogami_subgroups.nim rename to constantine/named/constants/bn254_nogami_subgroups.nim index ce607b12..43ed8745 100644 --- a/constantine/math/constants/bn254_nogami_subgroups.nim +++ b/constantine/named/constants/bn254_nogami_subgroups.nim @@ -8,13 +8,13 @@ import # Internals - ../../platforms/abstractions, - ../config/curves, - ../arithmetic, - ../extension_fields, - ../ec_shortweierstrass, - ../io/io_bigints, - ../isogenies/frobenius + constantine/platforms/abstractions, + constantine/named/algebra, + constantine/math/arithmetic, + constantine/math/extension_fields, + constantine/math/ec_shortweierstrass, + constantine/math/io/io_bigints, + constantine/math/isogenies/frobenius func pow_BN254_Nogami_abs_u*[ECP: ECP_ShortW[Fp[BN254_Nogami], G1] or ECP_ShortW[Fp2[BN254_Nogami], G2]]( @@ -89,7 +89,7 @@ func clearCofactorFast*(P: var ECP_ShortW[Fp[BN254_Nogami], G1]) {.inline.} = # BN G2 # ------------------------------------------------------------ # -# Implementation +# Implementation # Fuentes-Castaneda et al, "Fast Hashing to G2 on Pairing-Friendly Curves", https://doi.org/10.1007/978-3-642-28496-0_25* func clearCofactorFast*(P: var ECP_ShortW[Fp2[BN254_Nogami], G2]) {.inline.} = @@ -100,8 +100,8 @@ func clearCofactorFast*(P: var ECP_ShortW[Fp2[BN254_Nogami], G2]) {.inline.} = xP.pow_BN254_Nogami_u(P) # xP = [x]P t.frobenius_psi(P, 3) # t = ψ³(P) - P.double(xP) - P += xP + P.double(xP) + P += xP P.frobenius_psi(P) # P = [3x]ψ(P) P += t # P = [3x]ψ(P) + ψ³(P) t.frobenius_psi(xP, 2) # t = [x]ψ²(P) @@ -119,7 +119,7 @@ func isInSubgroup*(P: ECP_ShortW[Fp[BN254_Nogami], G1]): SecretBool {.inline.} = ## A point may be on a curve but not on the prime order r subgroup. ## Not checking subgroup exposes a protocol to small subgroup attacks. ## This is a no-op as on G1, all points are in the correct subgroup. - ## + ## ## Warning ⚠: Assumes that P is on curve return CtTrue @@ -131,22 +131,22 @@ func isInSubgroup*(P: ECP_ShortW_Jac[Fp2[BN254_Nogami], G2] or ECP_ShortW_Prj[Fp # A note on group membership tests for G1, G2 and GT # on BLS pairing-friendly curves # - # The condition to apply the optimized endomorphism check on G₂ + # The condition to apply the optimized endomorphism check on G₂ # is gcd(h₁, h₂) == 1 with h₁ and h₂ the cofactors on G₁ and G₂. # In that case [p]Q == [t-1]Q as r = p+1-t and [r]Q = 0 # For BN curves h₁ = 1, hence Scott group membership tests can be used for BN curves - # + # # p the prime modulus: 36u⁴ + 36u³ + 24u² + 6u + 1 # r the prime order: 36u⁴ + 36u³ + 18u² + 6u + 1 # t the trace: 6u² + 1 var t0{.noInit.}, t1{.noInit.}: typeof(P) - + t0.pow_BN254_Nogami_u(P) # [u]P t1.pow_BN254_Nogami_u(t0) # [u²]P t0.double(t1) # [2u²]P t0 += t1 # [3u²]P t0.double() # [6u²]P - + t1.frobenius_psi(P) # ψ(P) return t0 == t1 @@ -155,8 +155,8 @@ func isInSubgroup*(P: ECP_ShortW_Aff[Fp2[BN254_Nogami], G2]): SecretBool = ## Returns true if P is in 𝔾2 subgroup, i.e. P is a point of order r. ## A point may be on a curve but not on the prime order r subgroup. ## Not checking subgroup exposes a protocol to small subgroup attacks. - ## + ## ## Warning ⚠: Assumes that P is on curve var t{.noInit.}: ECP_ShortW_Jac[Fp2[BN254_Nogami], G2] t.fromAffine(P) - return t.isInSubgroup() \ No newline at end of file + return t.isInSubgroup() diff --git a/constantine/math/constants/bn254_snarks_constants.nim b/constantine/named/constants/bn254_snarks_constants.nim similarity index 88% rename from constantine/math/constants/bn254_snarks_constants.nim rename to constantine/named/constants/bn254_snarks_constants.nim index 26a04fbb..1e5a85aa 100644 --- a/constantine/math/constants/bn254_snarks_constants.nim +++ b/constantine/named/constants/bn254_snarks_constants.nim @@ -7,18 +7,18 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../config/curves, - ../io/io_extfields + constantine/named/algebra, + constantine/math/io/io_extfields {.used.} # Curve precomputed parameters # ----------------------------------------------------------------- -const BN254_Snarks_coefB_G2* = Fp2[BN254_Snarks].fromHex( +const BN254_Snarks_coefB_G2* = Fp2[BN254_Snarks].fromHex( "0x2b149d40ceb8aaae81be18991be06ac3b5b4c5e559dbefa33267e6dc24a138e5", "0x9713b03af0fed4cd2cafadeed8fdf4a74fa084e52d1852e4a2bd0685c315d2" ) -const BN254_Snarks_coefB_G2_times_3* = Fp2[BN254_Snarks].fromHex( +const BN254_Snarks_coefB_G2_times_3* = Fp2[BN254_Snarks].fromHex( "0x20753adca9c6bfb81499be5e509e8f8ff21b7c8d3cb039cf1ef69c66bce9b021", "0x1c53b10b0d2fc7e67860f09cc8af9ddf5eee18eaf8748f8ade8371391494176" ) diff --git a/constantine/math/constants/bn254_snarks_endomorphisms.nim b/constantine/named/constants/bn254_snarks_endomorphisms.nim similarity index 97% rename from constantine/math/constants/bn254_snarks_endomorphisms.nim rename to constantine/named/constants/bn254_snarks_endomorphisms.nim index b874d7df..84b14acd 100644 --- a/constantine/math/constants/bn254_snarks_endomorphisms.nim +++ b/constantine/named/constants/bn254_snarks_endomorphisms.nim @@ -7,8 +7,8 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../config/curves, - ../io/[io_bigints, io_fields] + constantine/named/algebra, + constantine/math/io/[io_bigints, io_fields] {.used.} diff --git a/constantine/math/constants/bn254_snarks_frobenius.nim b/constantine/named/constants/bn254_snarks_frobenius.nim similarity index 98% rename from constantine/math/constants/bn254_snarks_frobenius.nim rename to constantine/named/constants/bn254_snarks_frobenius.nim index d4c73d9a..1b5c2e1d 100644 --- a/constantine/math/constants/bn254_snarks_frobenius.nim +++ b/constantine/named/constants/bn254_snarks_frobenius.nim @@ -7,9 +7,9 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../config/curves, - ../extension_fields, - ../io/io_extfields + constantine/named/algebra, + constantine/math/extension_fields, + constantine/math/io/io_extfields {.used.} diff --git a/constantine/math/constants/bn254_snarks_generators.nim b/constantine/named/constants/bn254_snarks_generators.nim similarity index 92% rename from constantine/math/constants/bn254_snarks_generators.nim rename to constantine/named/constants/bn254_snarks_generators.nim index fd02e247..c7991b24 100644 --- a/constantine/math/constants/bn254_snarks_generators.nim +++ b/constantine/named/constants/bn254_snarks_generators.nim @@ -7,9 +7,9 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../config/curves, - ../elliptic/ec_shortweierstrass_affine, - ../io/[io_fields, io_extfields] + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_affine, + constantine/math/io/[io_fields, io_extfields] {.used.} @@ -17,7 +17,7 @@ import # ----------------------------------------------------------------- # https://github.com/ethereum/EIPs/blob/master/EIPS/eip-197.md -# The group G_1 is defined on the curve Y^2 = X^3 + 3 over the field F_p +# The group G_1 is defined on the curve Y^2 = X^3 + 3 over the field F_p # with p = 21888242871839275222246405745257275088696311157297823662689037894645226208583 # with generator P1 = (1, 2). const BN254_Snarks_generator_G1* = ECP_ShortW_Aff[Fp[BN254_Snarks], G1]( @@ -26,7 +26,7 @@ const BN254_Snarks_generator_G1* = ECP_ShortW_Aff[Fp[BN254_Snarks], G1]( ) # The group G_2 is defined on the curve Y^2 = X^3 + 3/(i+9) -# over a different field F_p^2 = F_p[i] / (i^2 + 1) (p is the same as above) +# over a different field F_p^2 = F_p[i] / (i^2 + 1) (p is the same as above) # with generator # P2 = ( # 11559732032986387107991004021392285783925812861821192530917403151452391805634 * i + diff --git a/constantine/math/constants/bn254_snarks_hash_to_curve_g1.nim b/constantine/named/constants/bn254_snarks_hash_to_curve_g1.nim similarity index 80% rename from constantine/math/constants/bn254_snarks_hash_to_curve_g1.nim rename to constantine/named/constants/bn254_snarks_hash_to_curve_g1.nim index 74c045b2..0d628d9d 100644 --- a/constantine/math/constants/bn254_snarks_hash_to_curve_g1.nim +++ b/constantine/named/constants/bn254_snarks_hash_to_curve_g1.nim @@ -7,8 +7,8 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../config/curves, - ../io/io_fields + constantine/named/algebra, + constantine/math/io/io_fields {.used.} @@ -17,13 +17,13 @@ import # Spec: # - https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-hash-to-curve-14#appendix-F.1 -const BN254_Snarks_h2c_svdw_G1_Z* = Fp[BN254_Snarks].fromHex( +const BN254_Snarks_h2c_svdw_G1_Z* = Fp[BN254_Snarks].fromHex( "0x1") -const BN254_Snarks_h2c_svdw_G1_curve_eq_rhs_Z* = Fp[BN254_Snarks].fromHex( +const BN254_Snarks_h2c_svdw_G1_curve_eq_rhs_Z* = Fp[BN254_Snarks].fromHex( "0x4") -const BN254_Snarks_h2c_svdw_G1_minus_Z_div_2* = Fp[BN254_Snarks].fromHex( +const BN254_Snarks_h2c_svdw_G1_minus_Z_div_2* = Fp[BN254_Snarks].fromHex( "0x183227397098d014dc2822db40c0ac2ecbc0b548b438e5469e10460b6c3e7ea3") -const BN254_Snarks_h2c_svdw_G1_z3* = Fp[BN254_Snarks].fromHex( +const BN254_Snarks_h2c_svdw_G1_z3* = Fp[BN254_Snarks].fromHex( "0x16789af3a83522eb353c98fc6b36d713d5d8d1cc5dffffffa") -const BN254_Snarks_h2c_svdw_G1_z4* = Fp[BN254_Snarks].fromHex( +const BN254_Snarks_h2c_svdw_G1_z4* = Fp[BN254_Snarks].fromHex( "0x10216f7ba065e00de81ac1e7808072c9dd2b2385cd7b438469602eb24829a9bd") diff --git a/constantine/math/constants/bn254_snarks_hash_to_curve_g2.nim b/constantine/named/constants/bn254_snarks_hash_to_curve_g2.nim similarity index 83% rename from constantine/math/constants/bn254_snarks_hash_to_curve_g2.nim rename to constantine/named/constants/bn254_snarks_hash_to_curve_g2.nim index f73b4491..d4cf8a6e 100644 --- a/constantine/math/constants/bn254_snarks_hash_to_curve_g2.nim +++ b/constantine/named/constants/bn254_snarks_hash_to_curve_g2.nim @@ -7,8 +7,8 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../config/curves, - ../io/io_extfields + constantine/named/algebra, + constantine/math/io/io_extfields {.used.} @@ -17,23 +17,23 @@ import # Spec: # - https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-hash-to-curve-14#appendix-F.1 -const BN254_Snarks_h2c_svdw_G2_Z* = Fp2[BN254_Snarks].fromHex( +const BN254_Snarks_h2c_svdw_G2_Z* = Fp2[BN254_Snarks].fromHex( "0x0", "0x1" ) -const BN254_Snarks_h2c_svdw_G2_curve_eq_rhs_Z* = Fp2[BN254_Snarks].fromHex( +const BN254_Snarks_h2c_svdw_G2_curve_eq_rhs_Z* = Fp2[BN254_Snarks].fromHex( "0x2b149d40ceb8aaae81be18991be06ac3b5b4c5e559dbefa33267e6dc24a138e5", "0x9713b03af0fed4cd2cafadeed8fdf4a74fa084e52d1852e4a2bd0685c315d1" ) -const BN254_Snarks_h2c_svdw_G2_minus_Z_div_2* = Fp2[BN254_Snarks].fromHex( +const BN254_Snarks_h2c_svdw_G2_minus_Z_div_2* = Fp2[BN254_Snarks].fromHex( "0x0", "0x183227397098d014dc2822db40c0ac2ecbc0b548b438e5469e10460b6c3e7ea3" ) -const BN254_Snarks_h2c_svdw_G2_z3* = Fp2[BN254_Snarks].fromHex( +const BN254_Snarks_h2c_svdw_G2_z3* = Fp2[BN254_Snarks].fromHex( "0x1248cccf0e2a72383dec3a1621130a65c0eb5d826ca664d3f4fce46f983efce6", "0x220de2a91cc408cf05ff76bf76fb88febaac1173cab9c8ebc03c7f9dc5569f10" ) -const BN254_Snarks_h2c_svdw_G2_z4* = Fp2[BN254_Snarks].fromHex( +const BN254_Snarks_h2c_svdw_G2_z4* = Fp2[BN254_Snarks].fromHex( "0x294f62301de5ae301a38098f4f5570e5bfc5e456aa54a6aa847fafc89357f76f", "0xc96f95a3ebfe711190ea3d3e76a7f0df14d60686e6cb1930d8fc08b259726c" ) diff --git a/constantine/math/constants/bn254_snarks_pairings.nim b/constantine/named/constants/bn254_snarks_pairings.nim similarity index 94% rename from constantine/math/constants/bn254_snarks_pairings.nim rename to constantine/named/constants/bn254_snarks_pairings.nim index b82323ad..6b791add 100644 --- a/constantine/math/constants/bn254_snarks_pairings.nim +++ b/constantine/named/constants/bn254_snarks_pairings.nim @@ -7,12 +7,12 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../../platforms/abstractions, - ../config/curves, - ../io/io_bigints, - ../extension_fields, - ../pairings/cyclotomic_subgroups, - ../isogenies/frobenius + constantine/platforms/abstractions, + constantine/named/algebra, + constantine/math/io/io_bigints, + constantine/math/extension_fields, + constantine/math/pairings/cyclotomic_subgroups, + constantine/math/isogenies/frobenius # Slow generic implementation # ------------------------------------------------------------ @@ -116,4 +116,4 @@ func isInPairingSubgroup*(a: Fp12[BN254_Snarks]): SecretBool = t1.frobenius_map(a) - return t0 == t1 \ No newline at end of file + return t0 == t1 diff --git a/constantine/math/constants/bn254_snarks_sqrt.nim b/constantine/named/constants/bn254_snarks_sqrt.nim similarity index 98% rename from constantine/math/constants/bn254_snarks_sqrt.nim rename to constantine/named/constants/bn254_snarks_sqrt.nim index 27bf4b37..c7f291bd 100644 --- a/constantine/math/constants/bn254_snarks_sqrt.nim +++ b/constantine/named/constants/bn254_snarks_sqrt.nim @@ -7,8 +7,8 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../config/curves, - ../arithmetic/finite_fields + constantine/named/algebra, + constantine/math/arithmetic/finite_fields # ############################################################ # diff --git a/constantine/math/constants/bn254_snarks_sqrt_fp2.nim b/constantine/named/constants/bn254_snarks_sqrt_fp2.nim similarity index 94% rename from constantine/math/constants/bn254_snarks_sqrt_fp2.nim rename to constantine/named/constants/bn254_snarks_sqrt_fp2.nim index 4a19103b..97117ca8 100644 --- a/constantine/math/constants/bn254_snarks_sqrt_fp2.nim +++ b/constantine/named/constants/bn254_snarks_sqrt_fp2.nim @@ -7,8 +7,8 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../config/curves, - ../io/io_extfields + constantine/named/algebra, + constantine/math/io/io_extfields {.used.} diff --git a/constantine/math/constants/bn254_snarks_subgroups.nim b/constantine/named/constants/bn254_snarks_subgroups.nim similarity index 95% rename from constantine/math/constants/bn254_snarks_subgroups.nim rename to constantine/named/constants/bn254_snarks_subgroups.nim index 3de212a1..ac6f44ef 100644 --- a/constantine/math/constants/bn254_snarks_subgroups.nim +++ b/constantine/named/constants/bn254_snarks_subgroups.nim @@ -8,13 +8,13 @@ import # Internals - ../../platforms/abstractions, - ../config/curves, - ../arithmetic, - ../extension_fields, - ../ec_shortweierstrass, - ../io/io_bigints, - ../isogenies/frobenius + constantine/platforms/abstractions, + constantine/named/algebra, + constantine/math/arithmetic, + constantine/math/extension_fields, + constantine/math/ec_shortweierstrass, + constantine/math/io/io_bigints, + constantine/math/isogenies/frobenius func pow_bn254_snarks_abs_u*[ECP: ECP_ShortW[Fp[BN254_Snarks], G1] or ECP_ShortW[Fp2[BN254_Snarks], G2]]( @@ -154,7 +154,7 @@ func clearCofactorFast*(P: var ECP_ShortW[Fp[BN254_Snarks], G1]) {.inline.} = # BN G2 # ------------------------------------------------------------ # -# Implementation +# Implementation # Fuentes-Castaneda et al, "Fast Hashing to G2 on Pairing-Friendly Curves", https://doi.org/10.1007/978-3-642-28496-0_25* func clearCofactorFast*(P: var ECP_ShortW[Fp2[BN254_Snarks], G2]) {.inline.} = @@ -165,8 +165,8 @@ func clearCofactorFast*(P: var ECP_ShortW[Fp2[BN254_Snarks], G2]) {.inline.} = xP.pow_bn254_snarks_u(P) # xP = [x]P t.frobenius_psi(P, 3) # t = ψ³(P) - P.double(xP) - P += xP + P.double(xP) + P += xP P.frobenius_psi(P) # P = [3x]ψ(P) P += t # P = [3x]ψ(P) + ψ³(P) t.frobenius_psi(xP, 2) # t = [x]ψ²(P) @@ -184,7 +184,7 @@ func isInSubgroup*(P: ECP_ShortW[Fp[BN254_Snarks], G1]): SecretBool {.inline.} = ## A point may be on a curve but not on the prime order r subgroup. ## Not checking subgroup exposes a protocol to small subgroup attacks. ## This is a no-op as on G1, all points are in the correct subgroup. - ## + ## ## Warning ⚠: Assumes that P is on curve return CtTrue @@ -196,22 +196,22 @@ func isInSubgroup*(P: ECP_ShortW_Jac[Fp2[BN254_Snarks], G2] or ECP_ShortW_Prj[Fp # A note on group membership tests for G1, G2 and GT # on BLS pairing-friendly curves # - # The condition to apply the optimized endomorphism check on G₂ + # The condition to apply the optimized endomorphism check on G₂ # is gcd(h₁, h₂) == 1 with h₁ and h₂ the cofactors on G₁ and G₂. # In that case [p]Q == [t-1]Q as r = p+1-t and [r]Q = 0 # For BN curves h₁ = 1, hence Scott group membership tests can be used for BN curves - # + # # p the prime modulus: 36u⁴ + 36u³ + 24u² + 6u + 1 # r the prime order: 36u⁴ + 36u³ + 18u² + 6u + 1 # t the trace: 6u² + 1 var t0{.noInit.}, t1{.noInit.}: typeof(P) - + t0.pow_bn254_snarks_u(P) # [u]P t1.pow_bn254_snarks_u(t0) # [u²]P t0.double(t1) # [2u²]P t0 += t1 # [3u²]P t0.double() # [6u²]P - + t1.frobenius_psi(P) # ψ(P) return t0 == t1 @@ -220,8 +220,8 @@ func isInSubgroup*(P: ECP_ShortW_Aff[Fp2[BN254_Snarks], G2]): SecretBool = ## Returns true if P is in 𝔾2 subgroup, i.e. P is a point of order r. ## A point may be on a curve but not on the prime order r subgroup. ## Not checking subgroup exposes a protocol to small subgroup attacks. - ## + ## ## Warning ⚠: Assumes that P is on curve var t{.noInit.}: ECP_ShortW_Jac[Fp2[BN254_Snarks], G2] t.fromAffine(P) - return t.isInSubgroup() \ No newline at end of file + return t.isInSubgroup() diff --git a/constantine/math/constants/bw6_761_constants.nim b/constantine/named/constants/bw6_761_constants.nim similarity index 77% rename from constantine/math/constants/bw6_761_constants.nim rename to constantine/named/constants/bw6_761_constants.nim index f38403b0..6ca5d007 100644 --- a/constantine/math/constants/bw6_761_constants.nim +++ b/constantine/named/constants/bw6_761_constants.nim @@ -7,14 +7,14 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../config/curves, - ../io/[io_fields, io_extfields] + constantine/named/algebra, + constantine/math/io/[io_fields, io_extfields] {.used.} # Curve precomputed parameters # ----------------------------------------------------------------- -const BW6_761_coefB_G2* = Fp[BW6_761].fromHex( +const BW6_761_coefB_G2* = Fp[BW6_761].fromHex( "0x4") -const BW6_761_coefB_G2_times_3* = Fp[BW6_761].fromHex( +const BW6_761_coefB_G2_times_3* = Fp[BW6_761].fromHex( "0xc") diff --git a/constantine/math/constants/bw6_761_endomorphisms.nim b/constantine/named/constants/bw6_761_endomorphisms.nim similarity index 96% rename from constantine/math/constants/bw6_761_endomorphisms.nim rename to constantine/named/constants/bw6_761_endomorphisms.nim index 627f38b7..b6c3ebf4 100644 --- a/constantine/math/constants/bw6_761_endomorphisms.nim +++ b/constantine/named/constants/bw6_761_endomorphisms.nim @@ -7,8 +7,8 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../config/curves, - ../io/[io_bigints, io_fields] + constantine/named/algebra, + constantine/math/io/[io_bigints, io_fields] {.used.} diff --git a/constantine/math/constants/bw6_761_frobenius.nim b/constantine/named/constants/bw6_761_frobenius.nim similarity index 98% rename from constantine/math/constants/bw6_761_frobenius.nim rename to constantine/named/constants/bw6_761_frobenius.nim index ba624b12..d34c2d03 100644 --- a/constantine/math/constants/bw6_761_frobenius.nim +++ b/constantine/named/constants/bw6_761_frobenius.nim @@ -7,9 +7,9 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../config/curves, - ../extension_fields, - ../io/[io_fields, io_extfields] + constantine/named/algebra, + constantine/math/extension_fields, + constantine/math/io/[io_fields, io_extfields] {.used.} diff --git a/constantine/math/constants/bw6_761_pairings.nim b/constantine/named/constants/bw6_761_pairings.nim similarity index 96% rename from constantine/math/constants/bw6_761_pairings.nim rename to constantine/named/constants/bw6_761_pairings.nim index ab561b34..d86d8c42 100644 --- a/constantine/math/constants/bw6_761_pairings.nim +++ b/constantine/named/constants/bw6_761_pairings.nim @@ -7,12 +7,12 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../../platforms/abstractions, - ../config/curves, - ../io/io_bigints, - ../extension_fields, - ../pairings/cyclotomic_subgroups, - ../isogenies/frobenius + constantine/platforms/abstractions, + constantine/named/algebra, + constantine/math/io/io_bigints, + constantine/math/extension_fields, + constantine/math/pairings/cyclotomic_subgroups, + constantine/math/isogenies/frobenius # Slow generic implementation # ------------------------------------------------------------ @@ -159,4 +159,4 @@ func isInPairingSubgroup*(a: Fp6[BW6_761]): SecretBool = u3.cyclotomic_square(u1) # u3 = 2p u3 *= u1 # u3 = 3p - return u0 == u3 \ No newline at end of file + return u0 == u3 diff --git a/constantine/math/constants/bw6_761_sqrt.nim b/constantine/named/constants/bw6_761_sqrt.nim similarity index 99% rename from constantine/math/constants/bw6_761_sqrt.nim rename to constantine/named/constants/bw6_761_sqrt.nim index ea0d44b9..56d4a83a 100644 --- a/constantine/math/constants/bw6_761_sqrt.nim +++ b/constantine/named/constants/bw6_761_sqrt.nim @@ -7,8 +7,8 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../config/curves, - ../arithmetic/finite_fields + constantine/named/algebra, + constantine/math/arithmetic/finite_fields # ############################################################ # diff --git a/constantine/math/constants/bw6_761_subgroups.nim b/constantine/named/constants/bw6_761_subgroups.nim similarity index 87% rename from constantine/math/constants/bw6_761_subgroups.nim rename to constantine/named/constants/bw6_761_subgroups.nim index 39cfefa5..54993e4f 100644 --- a/constantine/math/constants/bw6_761_subgroups.nim +++ b/constantine/named/constants/bw6_761_subgroups.nim @@ -8,13 +8,13 @@ import # Internals - ../../platforms/abstractions, - ../config/curves, - ../arithmetic, - ../extension_fields, - ../ec_shortweierstrass, - ../io/io_bigints - # ../isogenies/frobenius + constantine/platforms/abstractions, + constantine/named/algebra, + constantine/math/arithmetic, + constantine/math/extension_fields, + constantine/math/ec_shortweierstrass, + constantine/math/io/io_bigints + # constantine/math/isogenies/frobenius # ############################################################ # diff --git a/constantine/math/constants/curve25519_sqrt.nim b/constantine/named/constants/curve25519_sqrt.nim similarity index 90% rename from constantine/math/constants/curve25519_sqrt.nim rename to constantine/named/constants/curve25519_sqrt.nim index eb4419b8..1e307e6c 100644 --- a/constantine/math/constants/curve25519_sqrt.nim +++ b/constantine/named/constants/curve25519_sqrt.nim @@ -7,12 +7,12 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../config/curves, - ../arithmetic/finite_fields + constantine/named/algebra, + constantine/math/arithmetic/finite_fields func invsqrt_addchain_pminus5over8*(r: var Fp[Edwards25519], a: Fp[Edwards25519]) = ## Returns a^((p-5)/8) = 2²⁵²-3 for inverse square root computation - + var t{.noInit.}, u{.noInit.}, v{.noinit.}: Fp[Edwards25519] u.square(a) # 2 v.square_repeated(u, 2) # 8 @@ -32,7 +32,7 @@ func invsqrt_addchain_pminus5over8*(r: var Fp[Edwards25519], a: Fp[Edwards25519] v *= u # 2¹⁰⁰-1 t.square_repeated(v, 100) # v *= t # 2²⁰⁰-1 - v.square_repeated(50) # + v.square_repeated(50) # u *= v # 2²⁵⁰-1 u.square_repeated(2) # 2²⁵²-4 - r.prod(a, u) # 2²⁵²-3 \ No newline at end of file + r.prod(a, u) # 2²⁵²-3 diff --git a/constantine/math/constants/jubjub_sqrt.nim b/constantine/named/constants/jubjub_sqrt.nim similarity index 87% rename from constantine/math/constants/jubjub_sqrt.nim rename to constantine/named/constants/jubjub_sqrt.nim index 523fcd7c..4c89f0e6 100644 --- a/constantine/math/constants/jubjub_sqrt.nim +++ b/constantine/named/constants/jubjub_sqrt.nim @@ -5,9 +5,9 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../config/curves, - ../io/[io_bigints, io_fields], - ../arithmetic/finite_fields + constantine/named/algebra, + constantine/math/io/[io_bigints, io_fields], + constantine/math/arithmetic/finite_fields const # with e = 2adicity diff --git a/constantine/math/constants/pallas_endomorphisms.nim b/constantine/named/constants/pallas_endomorphisms.nim similarity index 94% rename from constantine/math/constants/pallas_endomorphisms.nim rename to constantine/named/constants/pallas_endomorphisms.nim index 6944e694..d6fea6ea 100644 --- a/constantine/math/constants/pallas_endomorphisms.nim +++ b/constantine/named/constants/pallas_endomorphisms.nim @@ -7,8 +7,8 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../config/curves, - ../io/[io_bigints, io_fields] + constantine/named/algebra, + constantine/math/io/[io_bigints, io_fields] {.used.} @@ -31,5 +31,3 @@ const Pallas_Babai_G1* = ( (BigInt[129].fromHex"0x1279a745902a2654e32c49e4bffffffff", true), (BigInt[129].fromHex"0x1279a745903c12455ff2b871c00000003", false) ) - - diff --git a/constantine/math/constants/pallas_sqrt.nim b/constantine/named/constants/pallas_sqrt.nim similarity index 88% rename from constantine/math/constants/pallas_sqrt.nim rename to constantine/named/constants/pallas_sqrt.nim index 27b129c1..1b74a226 100644 --- a/constantine/math/constants/pallas_sqrt.nim +++ b/constantine/named/constants/pallas_sqrt.nim @@ -7,9 +7,9 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../config/curves, - ../io/[io_bigints, io_fields], - ../arithmetic/finite_fields + constantine/named/algebra, + constantine/math/io/[io_bigints, io_fields], + constantine/math/arithmetic/finite_fields const # with e = 2adicity diff --git a/constantine/math/constants/pallas_subgroups.nim b/constantine/named/constants/pallas_subgroups.nim similarity index 91% rename from constantine/math/constants/pallas_subgroups.nim rename to constantine/named/constants/pallas_subgroups.nim index 6f6cd676..c6be4500 100644 --- a/constantine/math/constants/pallas_subgroups.nim +++ b/constantine/named/constants/pallas_subgroups.nim @@ -8,10 +8,10 @@ import # Internals - ../../platforms/abstractions, - ../config/curves, - ../arithmetic, - ../ec_shortweierstrass + constantine/platforms/abstractions, + constantine/named/algebra, + constantine/math/arithmetic, + constantine/math/ec_shortweierstrass # ############################################################ # diff --git a/constantine/math/constants/secp256k1_subgroups.nim b/constantine/named/constants/secp256k1_subgroups.nim similarity index 90% rename from constantine/math/constants/secp256k1_subgroups.nim rename to constantine/named/constants/secp256k1_subgroups.nim index bc25125a..d4cad325 100644 --- a/constantine/math/constants/secp256k1_subgroups.nim +++ b/constantine/named/constants/secp256k1_subgroups.nim @@ -8,10 +8,10 @@ import # Internals - ../../platforms/abstractions, - ../config/curves, - ../arithmetic, - ../ec_shortweierstrass + constantine/platforms/abstractions, + constantine/named/algebra, + constantine/math/arithmetic, + constantine/math/ec_shortweierstrass # ############################################################ # diff --git a/constantine/math/constants/vesta_endomorphisms.nim b/constantine/named/constants/vesta_endomorphisms.nim similarity index 94% rename from constantine/math/constants/vesta_endomorphisms.nim rename to constantine/named/constants/vesta_endomorphisms.nim index 64f49550..96d10094 100644 --- a/constantine/math/constants/vesta_endomorphisms.nim +++ b/constantine/named/constants/vesta_endomorphisms.nim @@ -7,8 +7,8 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../config/curves, - ../io/[io_bigints, io_fields] + constantine/named/algebra, + constantine/math/io/[io_bigints, io_fields] {.used.} @@ -31,5 +31,3 @@ const Vesta_Babai_G1* = ( (BigInt[129].fromHex"0x1279a745902a2654e32c49e4c00000003", true), (BigInt[129].fromHex"0x1279a745903c12455ff2b871bffffffff", false) ) - - diff --git a/constantine/math/constants/vesta_sqrt.nim b/constantine/named/constants/vesta_sqrt.nim similarity index 88% rename from constantine/math/constants/vesta_sqrt.nim rename to constantine/named/constants/vesta_sqrt.nim index 3972eb81..15bb7bab 100644 --- a/constantine/math/constants/vesta_sqrt.nim +++ b/constantine/named/constants/vesta_sqrt.nim @@ -7,9 +7,9 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../config/curves, - ../io/[io_bigints, io_fields], - ../arithmetic/finite_fields + constantine/named/algebra, + constantine/math/io/[io_bigints, io_fields], + constantine/math/arithmetic/finite_fields const # with e = 2adicity diff --git a/constantine/math/constants/vesta_subgroups.nim b/constantine/named/constants/vesta_subgroups.nim similarity index 91% rename from constantine/math/constants/vesta_subgroups.nim rename to constantine/named/constants/vesta_subgroups.nim index 1bdb87a1..b0f64d2b 100644 --- a/constantine/math/constants/vesta_subgroups.nim +++ b/constantine/named/constants/vesta_subgroups.nim @@ -8,10 +8,10 @@ import # Internals - ../../platforms/abstractions, - ../config/curves, - ../arithmetic, - ../ec_shortweierstrass + constantine/platforms/abstractions, + constantine/named/algebra, + constantine/math/arithmetic, + constantine/math/ec_shortweierstrass # ############################################################ # diff --git a/constantine/math/config/README.md b/constantine/named/deriv/README.md similarity index 100% rename from constantine/math/config/README.md rename to constantine/named/deriv/README.md diff --git a/constantine/math/config/curves_derived.nim b/constantine/named/deriv/derive_constants.nim similarity index 99% rename from constantine/math/config/curves_derived.nim rename to constantine/named/deriv/derive_constants.nim index 7429a1bc..a151c355 100644 --- a/constantine/math/config/curves_derived.nim +++ b/constantine/named/deriv/derive_constants.nim @@ -11,7 +11,7 @@ import std/macros, # Internal ./precompute, - ./curves_declaration + ../config_fields_and_curves {.experimental: "dynamicBindSym".} diff --git a/constantine/math/config/curves_parser_curve.nim b/constantine/named/deriv/parser_curves.nim similarity index 96% rename from constantine/math/config/curves_parser_curve.nim rename to constantine/named/deriv/parser_curves.nim index a81b2af2..bd99b492 100644 --- a/constantine/math/config/curves_parser_curve.nim +++ b/constantine/named/deriv/parser_curves.nim @@ -9,9 +9,10 @@ import # Standard library std/macros, # Internal - ./type_bigint, ./type_ff, - ../io/[io_bigints, io_fields], - ./curves_declaration, ./curves_parser_field + constantine/platforms/type_ff, + constantine/math/io/[io_bigints, io_fields], + ../config_fields_and_curves, + ./parser_fields export CurveFamily, Curve, SexticTwist @@ -121,4 +122,4 @@ proc genCurveConstants(defs: seq[CurveParams]): NimNode = macro setupCurves(): untyped = result = genCurveConstants(curvesDefinitions) -setupCurves() \ No newline at end of file +setupCurves() diff --git a/constantine/math/config/curves_parser_field.nim b/constantine/named/deriv/parser_fields.nim similarity index 99% rename from constantine/math/config/curves_parser_field.nim rename to constantine/named/deriv/parser_fields.nim index 45bb6f38..ea3dd6d5 100644 --- a/constantine/math/config/curves_parser_field.nim +++ b/constantine/named/deriv/parser_fields.nim @@ -10,8 +10,8 @@ import # Standard library std/[macros, strutils], # Internal - ../io/io_bigints, - ./type_bigint + constantine/platforms/abstractions, + constantine/math/io/io_bigints # Parsing is done in 2 steps: # 1. All declared parameters are collected in a {.compileTime.} seq[CurveParams] diff --git a/constantine/math/config/precompute.nim b/constantine/named/deriv/precompute.nim similarity index 99% rename from constantine/math/config/precompute.nim rename to constantine/named/deriv/precompute.nim index 06e814a1..f428d2a2 100644 --- a/constantine/math/config/precompute.nim +++ b/constantine/named/deriv/precompute.nim @@ -7,9 +7,8 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../../platforms/abstractions, - ./type_bigint, - ../io/io_bigints + constantine/platforms/abstractions, + constantine/math/io/io_bigints {.used.} diff --git a/constantine/math/config/curves_prop_curve.nim b/constantine/named/properties_curves.nim similarity index 98% rename from constantine/math/config/curves_prop_curve.nim rename to constantine/named/properties_curves.nim index 1f663886..c24724a7 100644 --- a/constantine/math/config/curves_prop_curve.nim +++ b/constantine/named/properties_curves.nim @@ -9,7 +9,8 @@ import # Standard library std/macros, # Internal - ./curves_declaration, ./curves_parser_curve + ./config_fields_and_curves, + ./deriv/parser_curves export CurveFamily, Curve, SexticTwist diff --git a/constantine/math/config/curves_prop_field_derived.nim b/constantine/named/properties_fields.nim similarity index 79% rename from constantine/math/config/curves_prop_field_derived.nim rename to constantine/named/properties_fields.nim index 4f2992ce..0c94942b 100644 --- a/constantine/math/config/curves_prop_field_derived.nim +++ b/constantine/named/properties_fields.nim @@ -10,9 +10,46 @@ import # Standard library std/macros, # Internal - ../../platforms/abstractions, - ./type_bigint, ./type_ff, - ./curves_declaration, ./curves_prop_field_core, ./curves_derived + ../platforms/[abstractions, type_ff], + ./config_fields_and_curves, + ./deriv/derive_constants + +export Curve, type_ff + +# ############################################################ +# +# Field properties +# +# ############################################################ + +{.experimental: "dynamicBindSym".} + +export matchingBigInt +export matchingOrderBigInt + +macro Mod*(C: static Curve): untyped = + ## Get the Modulus associated to a curve + result = bindSym($C & "_Modulus") + +template matchingLimbs2x*(C: Curve): untyped = + const N2 = wordsRequired(CurveBitWidth[C]) * 2 # TODO upstream, not precomputing N2 breaks semcheck + array[N2, SecretWord] # TODO upstream, using Limbs[N2] breaks semcheck + +func has_P_3mod4_primeModulus*(C: static Curve): static bool = + ## Returns true iff p ≡ 3 (mod 4) + (BaseType(C.Mod.limbs[0]) and 3) == 3 + +func has_P_5mod8_primeModulus*(C: static Curve): static bool = + ## Returns true iff p ≡ 5 (mod 8) + (BaseType(C.Mod.limbs[0]) and 7) == 5 + +func has_P_9mod16_primeModulus*(C: static Curve): static bool = + ## Returns true iff p ≡ 9 (mod 16) + (BaseType(C.Mod.limbs[0]) and 15) == 9 + +func has_Psquare_9mod16_primePower*(C: static Curve): static bool = + ## Returns true iff p² ≡ 9 (mod 16) + ((BaseType(C.Mod.limbs[0]) * BaseType(C.Mod.limbs[0])) and 15) == 9 # ############################################################ # diff --git a/constantine/math/constants/zoo_constants.nim b/constantine/named/zoo_constants.nim similarity index 83% rename from constantine/math/constants/zoo_constants.nim rename to constantine/named/zoo_constants.nim index 8449070f..b790c0e7 100644 --- a/constantine/math/constants/zoo_constants.nim +++ b/constantine/named/zoo_constants.nim @@ -8,12 +8,12 @@ import std/macros, - ../config/curves, - ./bls12_377_constants, - ./bls12_381_constants, - ./bn254_nogami_constants, - ./bn254_snarks_constants, - ./bw6_761_constants + ./algebra, + ./constants/bls12_377_constants, + ./constants/bls12_381_constants, + ./constants/bn254_nogami_constants, + ./constants/bn254_snarks_constants, + ./constants/bw6_761_constants {.experimental: "dynamicBindSym".} @@ -33,4 +33,4 @@ macro getCoefB_G2_times_3*(C: static Curve): untyped = ## y² = x³ + b/µ (D-Twist) ## y² = x³ + b*µ (M-Twist) ## with µ the non-residue (sextic non-residue with a sextic twist) - return bindSym($C & "_coefB_G2_times_3") \ No newline at end of file + return bindSym($C & "_coefB_G2_times_3") diff --git a/constantine/math/constants/zoo_endomorphisms.nim b/constantine/named/zoo_endomorphisms.nim similarity index 81% rename from constantine/math/constants/zoo_endomorphisms.nim rename to constantine/named/zoo_endomorphisms.nim index 62483410..aaa251f8 100644 --- a/constantine/math/constants/zoo_endomorphisms.nim +++ b/constantine/named/zoo_endomorphisms.nim @@ -8,15 +8,15 @@ import std/macros, - ../config/curves, - ../extension_fields, - ./bls12_377_endomorphisms, - ./bls12_381_endomorphisms, - ./bn254_nogami_endomorphisms, - ./bn254_snarks_endomorphisms, - ./bw6_761_endomorphisms, - ./pallas_endomorphisms, - ./vesta_endomorphisms + ./algebra, + ../math/extension_fields, + ./constants/bls12_377_endomorphisms, + ./constants/bls12_381_endomorphisms, + ./constants/bn254_nogami_endomorphisms, + ./constants/bn254_snarks_endomorphisms, + ./constants/bw6_761_endomorphisms, + ./constants/pallas_endomorphisms, + ./constants/vesta_endomorphisms {.experimental: "dynamicBindSym".} @@ -55,4 +55,4 @@ const EndomorphismThreshold* = 196 ## to split scalars for endomorphisms ## For small scalars the substraction will overflow ## - ## TODO: implement an alternative way to split scalars. \ No newline at end of file + ## TODO: implement an alternative way to split scalars. diff --git a/constantine/math/constants/zoo_frobenius.nim b/constantine/named/zoo_frobenius.nim similarity index 84% rename from constantine/math/constants/zoo_frobenius.nim rename to constantine/named/zoo_frobenius.nim index ea2ab01a..9845a402 100644 --- a/constantine/math/constants/zoo_frobenius.nim +++ b/constantine/named/zoo_frobenius.nim @@ -8,12 +8,12 @@ import std/macros, - ../config/curves, - ./bls12_377_frobenius, - ./bls12_381_frobenius, - ./bn254_nogami_frobenius, - ./bn254_snarks_frobenius, - ./bw6_761_frobenius + ./algebra, + ./constants/bls12_377_frobenius, + ./constants/bls12_381_frobenius, + ./constants/bn254_nogami_frobenius, + ./constants/bn254_snarks_frobenius, + ./constants/bw6_761_frobenius {.experimental: "dynamicBindSym".} diff --git a/constantine/math/constants/zoo_generators.nim b/constantine/named/zoo_generators.nim similarity index 83% rename from constantine/math/constants/zoo_generators.nim rename to constantine/named/zoo_generators.nim index 9ca25fd9..c3614a93 100644 --- a/constantine/math/constants/zoo_generators.nim +++ b/constantine/named/zoo_generators.nim @@ -8,11 +8,11 @@ import std/macros, - ../config/curves, - ./bls12_381_generators, - ./bn254_snarks_generators, - ./bandersnatch_generators, - ./banderwagon_generators + ./algebra, + ./constants/bls12_381_generators, + ./constants/bn254_snarks_generators, + ./constants/bandersnatch_generators, + ./constants/banderwagon_generators {.experimental: "dynamicbindsym".} diff --git a/constantine/math/constants/zoo_hash_to_curve.nim b/constantine/named/zoo_hash_to_curve.nim similarity index 82% rename from constantine/math/constants/zoo_hash_to_curve.nim rename to constantine/named/zoo_hash_to_curve.nim index d5e27c23..62320237 100644 --- a/constantine/math/constants/zoo_hash_to_curve.nim +++ b/constantine/named/zoo_hash_to_curve.nim @@ -8,12 +8,12 @@ import std/macros, - ../config/curves, - ../elliptic/ec_shortweierstrass_affine, - ./bls12_381_hash_to_curve_g1, - ./bls12_381_hash_to_curve_g2, - ./bn254_snarks_hash_to_curve_g1, - ./bn254_snarks_hash_to_curve_g2 + ./algebra, + ../math/elliptic/ec_shortweierstrass_affine, + ./constants/bls12_381_hash_to_curve_g1, + ./constants/bls12_381_hash_to_curve_g2, + ./constants/bn254_snarks_hash_to_curve_g1, + ./constants/bn254_snarks_hash_to_curve_g2 {.experimental: "dynamicBindSym".} diff --git a/constantine/math/constants/zoo_pairings.nim b/constantine/named/zoo_pairings.nim similarity index 80% rename from constantine/math/constants/zoo_pairings.nim rename to constantine/named/zoo_pairings.nim index 2b8d83b5..4c648017 100644 --- a/constantine/math/constants/zoo_pairings.nim +++ b/constantine/named/zoo_pairings.nim @@ -8,12 +8,12 @@ import std/macros, - ../config/curves, - ./bls12_377_pairings, - ./bls12_381_pairings, - ./bn254_nogami_pairings, - ./bn254_snarks_pairings, - ./bw6_761_pairings + ./algebra, + ./constants/bls12_377_pairings, + ./constants/bls12_381_pairings, + ./constants/bn254_nogami_pairings, + ./constants/bn254_snarks_pairings, + ./constants/bw6_761_pairings {.experimental: "dynamicBindSym".} diff --git a/constantine/math/constants/zoo_square_roots.nim b/constantine/named/zoo_square_roots.nim similarity index 80% rename from constantine/math/constants/zoo_square_roots.nim rename to constantine/named/zoo_square_roots.nim index eb5688e7..824b888c 100644 --- a/constantine/math/constants/zoo_square_roots.nim +++ b/constantine/named/zoo_square_roots.nim @@ -8,18 +8,18 @@ import std/macros, - ../config/curves, - ./bls12_377_sqrt, - ./bls12_381_sqrt, - ./bn254_nogami_sqrt, - ./bn254_snarks_sqrt, - ./bw6_761_sqrt, - ./curve25519_sqrt, - ./jubjub_sqrt, - ./bandersnatch_sqrt, - ./banderwagon_sqrt, - ./pallas_sqrt, - ./vesta_sqrt + ./algebra, + ./constants/bls12_377_sqrt, + ./constants/bls12_381_sqrt, + ./constants/bn254_nogami_sqrt, + ./constants/bn254_snarks_sqrt, + ./constants/bw6_761_sqrt, + ./constants/curve25519_sqrt, + ./constants/jubjub_sqrt, + ./constants/bandersnatch_sqrt, + ./constants/banderwagon_sqrt, + ./constants/pallas_sqrt, + ./constants/vesta_sqrt export bls12_377_sqrt, diff --git a/constantine/math/constants/zoo_square_roots_fp2.nim b/constantine/named/zoo_square_roots_fp2.nim similarity index 85% rename from constantine/math/constants/zoo_square_roots_fp2.nim rename to constantine/named/zoo_square_roots_fp2.nim index 2835655e..948cab6a 100644 --- a/constantine/math/constants/zoo_square_roots_fp2.nim +++ b/constantine/named/zoo_square_roots_fp2.nim @@ -8,10 +8,10 @@ import std/macros, - ../config/curves, - ./bls12_381_sqrt_fp2, - ./bn254_nogami_sqrt_fp2, - ./bn254_snarks_sqrt_fp2 + ./algebra, + ./constants/bls12_381_sqrt_fp2, + ./constants/bn254_nogami_sqrt_fp2, + ./constants/bn254_snarks_sqrt_fp2 {.experimental: "dynamicBindSym".} macro sqrt_fp2*(C: static Curve, value: untyped): untyped = diff --git a/constantine/math/constants/zoo_subgroups.nim b/constantine/named/zoo_subgroups.nim similarity index 75% rename from constantine/math/constants/zoo_subgroups.nim rename to constantine/named/zoo_subgroups.nim index d00a95df..cb016dfe 100644 --- a/constantine/math/constants/zoo_subgroups.nim +++ b/constantine/named/zoo_subgroups.nim @@ -8,16 +8,16 @@ import # Internals - ../config/curves, - ./bandersnatch_subgroups, - ./bls12_377_subgroups, - ./bls12_381_subgroups, - ./bn254_nogami_subgroups, - ./bn254_snarks_subgroups, - ./bw6_761_subgroups, - ./pallas_subgroups, - ./vesta_subgroups, - ./secp256k1_subgroups + ./algebra, + ./constants/bandersnatch_subgroups, + ./constants/bls12_377_subgroups, + ./constants/bls12_381_subgroups, + ./constants/bn254_nogami_subgroups, + ./constants/bn254_snarks_subgroups, + ./constants/bw6_761_subgroups, + ./constants/pallas_subgroups, + ./constants/vesta_subgroups, + ./constants/secp256k1_subgroups export bandersnatch_subgroups, diff --git a/constantine/platforms/abstractions.nim b/constantine/platforms/abstractions.nim index 9128c7ee..4d5ebc83 100644 --- a/constantine/platforms/abstractions.nim +++ b/constantine/platforms/abstractions.nim @@ -114,6 +114,34 @@ debug: # Don't allow printing secret words by default result.add ", " & toHex(a[i]) result.add "]" +# ############################################################ +# +# Big Integer +# +# ############################################################ + +type + BigInt*[bits: static int] = object + ## Fixed-precision big integer + ## + ## - "bits" is the announced bit-length of the BigInt + ## This is public data, usually equal to the curve prime bitlength. + ## + ## - "limbs" is an internal field that holds the internal representation + ## of the big integer. Least-significant limb first. Within limbs words are native-endian. + ## + ## This internal representation can be changed + ## without notice and should not be used by external applications or libraries. + limbs*: array[bits.wordsRequired, SecretWord] + +debug: + func `$`*(a: BigInt): string = + result = "BigInt[" + result.add $BigInt.bits + result.add "](limbs: " + result.add a.limbs.toString() + result.add ")" + # ############################################################ # # Signed Secret Words @@ -286,4 +314,4 @@ func ashr*( ## Arithmetic right-shift of a double-word ## This does not normalize the excess bits r.lo = r.lo.lshr(k) or r.hi.lshl(WordBitWidth - k) - r.hi = r.hi.ashr(k) \ No newline at end of file + r.hi = r.hi.ashr(k) diff --git a/constantine/platforms/code_generator/ir.nim b/constantine/platforms/code_generator/ir.nim index 2d50740a..801d22cb 100644 --- a/constantine/platforms/code_generator/ir.nim +++ b/constantine/platforms/code_generator/ir.nim @@ -7,8 +7,8 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../../math/config/[curves, precompute], - ../../math/io/io_bigints, + constantine/math/config/[curves, precompute], + constantine/math/io/io_bigints, ../primitives, ../bithacks, ../../serialization/[endians, codecs, io_limbs], ./llvm @@ -348,4 +348,4 @@ proc `[]=`*(a: Array, index: SomeInteger, val: ValueRef) {.inline.}= proc store*(builder: BuilderRef, dst: Array, src: Array) {.inline.}= let v = builder.load2(src.arrayTy, src.p) - builder.store(v, dst.p) \ No newline at end of file + builder.store(v, dst.p) diff --git a/constantine/math/config/type_ff.nim b/constantine/platforms/type_ff.nim similarity index 70% rename from constantine/math/config/type_ff.nim rename to constantine/platforms/type_ff.nim index 88d8fdff..446efa84 100644 --- a/constantine/math/config/type_ff.nim +++ b/constantine/platforms/type_ff.nim @@ -7,11 +7,20 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../../platforms/abstractions, - ./curves_declaration, - ./curves_prop_field_core + ./abstractions, + ../named/config_fields_and_curves -export matchingBigInt, matchingOrderBigInt +# TODO: Keep internal and use bigint(Fp[Foo]) and bigint(Fr[Foo]) + +template matchingBigInt*(C: static Curve): untyped = + ## BigInt type necessary to store the prime field Fp + # Workaround: https://github.com/nim-lang/Nim/issues/16774 + BigInt[CurveBitWidth[C]] + +template matchingOrderBigInt*(C: static Curve): untyped = + ## BigInt type necessary to store the scalar field Fr + # Workaround: https://github.com/nim-lang/Nim/issues/16774 + BigInt[CurveOrderBitWidth[C]] type Fp*[C: static Curve] = object @@ -33,7 +42,7 @@ type FF*[C: static Curve] = Fp[C] or Fr[C] debug: - import ./type_bigint + # Those MUST not be enabled in production to avoiding the compiler auto-conversion and printing SecretWord by mistake, for example in crash logs. func `$`*[C: static Curve](a: Fp[C]): string = result = "Fp[" & $C diff --git a/constantine/proof_systems/constraint_systems/r1cs_circom_parser.nim b/constantine/proof_systems/constraint_systems/r1cs_circom_parser.nim index e5a172fb..651e1da4 100644 --- a/constantine/proof_systems/constraint_systems/r1cs_circom_parser.nim +++ b/constantine/proof_systems/constraint_systems/r1cs_circom_parser.nim @@ -18,7 +18,7 @@ import ../../serialization/[io_limbs, parsing], - ../../platforms/[fileio, abstractions] + constantine/platforms/[fileio, abstractions] # We use `sortedByIt` to sort the different sections in the file by their # `R1csSectionKind` diff --git a/constantine/serialization/codecs_banderwagon.nim b/constantine/serialization/codecs_banderwagon.nim index 16919506..d4379f9b 100644 --- a/constantine/serialization/codecs_banderwagon.nim +++ b/constantine/serialization/codecs_banderwagon.nim @@ -13,19 +13,15 @@ ## ############################################################ import - ../platforms/abstractions, - ../math/config/curves, - ../math/elliptic/[ - ec_twistededwards_affine, - ec_twistededwards_projective], - ../math/arithmetic/limbs_montgomery, - ../math/[ - arithmetic/bigints, + constantine/platforms/abstractions, + constantine/named/algebra, + constantine/named/constants/banderwagon_subgroups, + constantine/math/ec_twistededwards, + constantine/math/arithmetic/limbs_montgomery, + constantine/math/[ extension_fields, - arithmetic, - constants/banderwagon_subgroups - ], - ../math/io/[io_bigints, io_fields], + arithmetic], + constantine/math/io/[io_bigints, io_fields], ./codecs_status_codes ## ############################################################ diff --git a/constantine/serialization/codecs_bls12_381.nim b/constantine/serialization/codecs_bls12_381.nim index 03720207..bc17eb0f 100644 --- a/constantine/serialization/codecs_bls12_381.nim +++ b/constantine/serialization/codecs_bls12_381.nim @@ -38,14 +38,14 @@ ## - https://github.com/zkcrypto/bls12_381/blob/0.6.0/src/notes/serialization.rs import - ../platforms/abstractions, - ../math/config/curves, - ../math/[ + constantine/platforms/abstractions, + constantine/named/algebra, + constantine/named/zoo_subgroups, + constantine/math/[ ec_shortweierstrass, extension_fields, - arithmetic, - constants/zoo_subgroups], - ../math/io/[io_bigints, io_fields], + arithmetic], + constantine/math/io/[io_bigints, io_fields], ./codecs_status_codes type diff --git a/constantine/signatures/bls_signatures.nim b/constantine/signatures/bls_signatures.nim index 10177769..23373a5a 100644 --- a/constantine/signatures/bls_signatures.nim +++ b/constantine/signatures/bls_signatures.nim @@ -7,15 +7,15 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../math/[ec_shortweierstrass, extension_fields], - ../math/io/io_bigints, - ../math/elliptic/ec_scalar_mul_vartime, - ../math/pairings/[pairings_generic, miller_accumulators], - ../math/constants/zoo_generators, - ../math/config/curves, - ../hash_to_curve/[hash_to_curve, h2c_hash_to_field], - ../hashes, - ../platforms/views + constantine/math/[ec_shortweierstrass, extension_fields], + constantine/math/io/io_bigints, + constantine/math/elliptic/ec_scalar_mul_vartime, + constantine/math/pairings/[pairings_generic, miller_accumulators], + constantine/named/zoo_generators, + constantine/named/algebra, + constantine/hash_to_curve/[hash_to_curve, h2c_hash_to_field], + constantine/hashes, + constantine/platforms/views # ############################################################ # diff --git a/constantine/threadpool/crossthread/taskqueues.nim b/constantine/threadpool/crossthread/taskqueues.nim index 8e71c7ff..1c1ca28b 100644 --- a/constantine/threadpool/crossthread/taskqueues.nim +++ b/constantine/threadpool/crossthread/taskqueues.nim @@ -34,7 +34,7 @@ import std/atomics, - ../../platforms/allocs, + constantine/platforms/allocs, ../instrumentation, ./tasks_flowvars diff --git a/constantine/threadpool/crossthread/tasks_flowvars.nim b/constantine/threadpool/crossthread/tasks_flowvars.nim index cd3e221a..74d5975c 100644 --- a/constantine/threadpool/crossthread/tasks_flowvars.nim +++ b/constantine/threadpool/crossthread/tasks_flowvars.nim @@ -8,7 +8,7 @@ import std/atomics, - ../../platforms/allocs, + constantine/platforms/allocs, ../primitives/futexes, ../instrumentation, ./scoped_barriers diff --git a/examples-threadpool/e01_simple_tasks.nim b/examples-threadpool/e01_simple_tasks.nim index f7b580b7..e730da86 100644 --- a/examples-threadpool/e01_simple_tasks.nim +++ b/examples-threadpool/e01_simple_tasks.nim @@ -1,4 +1,4 @@ -import ../constantine/threadpool +import constantine/threadpool block: # Async without result diff --git a/examples-threadpool/e02_parallel_pi.nim b/examples-threadpool/e02_parallel_pi.nim index ef40c010..43db9583 100644 --- a/examples-threadpool/e02_parallel_pi.nim +++ b/examples-threadpool/e02_parallel_pi.nim @@ -2,7 +2,7 @@ import std/[strutils, cpuinfo], - ../constantine/threadpool + constantine/threadpool # From https://github.com/nim-lang/Nim/blob/v1.6.2/tests/parallel/tpi.nim # Leibniz Formula https://en.wikipedia.org/wiki/Leibniz_formula_for_%CF%80 diff --git a/examples-threadpool/e03_parallel_for.nim b/examples-threadpool/e03_parallel_for.nim index 84140f96..4da9a82e 100644 --- a/examples-threadpool/e03_parallel_for.nim +++ b/examples-threadpool/e03_parallel_for.nim @@ -1,4 +1,4 @@ -import ../constantine/[threadpool, threadpool/instrumentation] +import constantine/[threadpool, threadpool/instrumentation] block: proc main() = @@ -57,4 +57,4 @@ block: # Nested loops echo "\n\nNested loops" echo "-------------------------" main3() - echo "-------------------------" \ No newline at end of file + echo "-------------------------" diff --git a/examples-threadpool/e04_parallel_reduce.nim b/examples-threadpool/e04_parallel_reduce.nim index 7e37277b..a89139b5 100644 --- a/examples-threadpool/e04_parallel_reduce.nim +++ b/examples-threadpool/e04_parallel_reduce.nim @@ -1,4 +1,4 @@ -import ../constantine/threadpool +import constantine/threadpool block: proc main() = @@ -31,4 +31,4 @@ block: echo "Simple parallel reduce" echo "-------------------------" main() - echo "-------------------------" \ No newline at end of file + echo "-------------------------" diff --git a/examples-threadpool/raytracing/smallpt.nim b/examples-threadpool/raytracing/smallpt.nim index 161add10..09db1c2a 100644 --- a/examples-threadpool/raytracing/smallpt.nim +++ b/examples-threadpool/raytracing/smallpt.nim @@ -209,7 +209,7 @@ proc tracer_single(C: var seq[Vec], w, h: static int, samples: int) = C[i] = C[i] + vec(r.x.clamp(), r.y.clamp(), r.z.clamp()) * 0.25 # / num subpixels when compileOption("threads"): - import ../../constantine/threadpool + import constantine/threadpool proc tracer_threaded(C: var seq[Vec], w, h: static int, samples: int) = # This gives the exact same result as single threaded and GCC OpenMP diff --git a/helpers/prng_unsafe.nim b/helpers/prng_unsafe.nim index e99ce8ab..59cc12f1 100644 --- a/helpers/prng_unsafe.nim +++ b/helpers/prng_unsafe.nim @@ -7,19 +7,19 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../constantine/platforms/abstractions, - ../constantine/math/arithmetic, - ../constantine/math/arithmetic/limbs_montgomery, - ../constantine/math/config/curves, - ../constantine/math/elliptic/[ + constantine/named/algebra, + constantine/platforms/abstractions, + constantine/math/arithmetic, + constantine/math/arithmetic/limbs_montgomery, + constantine/math/elliptic/[ ec_shortweierstrass_affine, ec_shortweierstrass_projective, ec_shortweierstrass_jacobian, ec_shortweierstrass_jacobian_extended, ec_twistededwards_affine, ec_twistededwards_projective], - ../constantine/math/io/io_bigints, - ../constantine/math/extension_fields/towers + constantine/math/io/io_bigints, + constantine/math/extension_fields/towers # ############################################################ # diff --git a/metering/m_eip2537.nim b/metering/m_eip2537.nim index 5cab1b44..eb341cf2 100644 --- a/metering/m_eip2537.nim +++ b/metering/m_eip2537.nim @@ -8,14 +8,14 @@ import std/times, - ../constantine/platforms/metering/[reports, tracer], - ../constantine/math/config/curves, - ../constantine/math/[arithmetic, extension_fields, ec_shortweierstrass], - ../constantine/math/constants/zoo_subgroups, - ../constantine/math/pairings/pairings_generic, - ../constantine/platforms/abstractions, + constantine/platforms/metering/[reports, tracer], + constantine/named/algebra, + constantine/math/[arithmetic, extension_fields, ec_shortweierstrass], + constantine/named/zoo_subgroups, + constantine/math/pairings/pairings_generic, + constantine/platforms/abstractions, # Helpers - ../helpers/prng_unsafe + helpers/prng_unsafe # Metering for EIP-2537 # ------------------------------------------------------------------------------- diff --git a/metering/m_modexp.nim b/metering/m_modexp.nim index 920ee0c8..384b30e7 100644 --- a/metering/m_modexp.nim +++ b/metering/m_modexp.nim @@ -7,9 +7,9 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../constantine/platforms/metering/[reports, tracer], - ../constantine/ethereum_evm_precompiles, - ../constantine/platforms/abstractions + constantine/platforms/metering/[reports, tracer], + constantine/ethereum_evm_precompiles, + constantine/platforms/abstractions let input = [ # Length of base (1) diff --git a/metering/m_msm.nim b/metering/m_msm.nim index 64e1282a..8c519edb 100644 --- a/metering/m_msm.nim +++ b/metering/m_msm.nim @@ -8,14 +8,14 @@ import std/times, - ../constantine/platforms/metering/[reports, tracer], - ../constantine/math/config/curves, - ../constantine/math/[arithmetic, extension_fields, ec_shortweierstrass], - ../constantine/math/constants/zoo_subgroups, - ../constantine/math/elliptic/ec_multi_scalar_mul, - ../constantine/platforms/abstractions, + constantine/platforms/metering/[reports, tracer], + constantine/named/algebra, + constantine/math/[arithmetic, extension_fields, ec_shortweierstrass], + constantine/named/zoo_subgroups, + constantine/math/elliptic/ec_multi_scalar_mul, + constantine/platforms/abstractions, # Helpers - ../helpers/prng_unsafe + helpers/prng_unsafe var rng*: RngState let seed = uint32(getTime().toUnix() and (1'i64 shl 32 - 1)) # unixTime mod 2^32 diff --git a/metering/m_pairings.nim b/metering/m_pairings.nim index 352020dd..c7f2f67b 100644 --- a/metering/m_pairings.nim +++ b/metering/m_pairings.nim @@ -8,14 +8,14 @@ import std/times, - ../constantine/platforms/metering/[reports, tracer], - ../constantine/math/config/curves, - ../constantine/math/[arithmetic, extension_fields, ec_shortweierstrass], - ../constantine/math/constants/zoo_subgroups, - ../constantine/math/pairings/pairings_generic, - ../constantine/platforms/abstractions, + constantine/platforms/metering/[reports, tracer], + constantine/named/algebra, + constantine/math/[arithmetic, extension_fields, ec_shortweierstrass], + constantine/named/zoo_subgroups, + constantine/math/pairings/pairings_generic, + constantine/platforms/abstractions, # Helpers - ../helpers/prng_unsafe + helpers/prng_unsafe var rng*: RngState let seed = uint32(getTime().toUnix() and (1'i64 shl 32 - 1)) # unixTime mod 2^32 diff --git a/research/codegen/nim.cfg b/research/codegen/nim.cfg index ffb8d7cc..c1344003 100644 --- a/research/codegen/nim.cfg +++ b/research/codegen/nim.cfg @@ -1 +1 @@ ---path:../../constantine/platforms/code_generator \ No newline at end of file +--path:constantine/platforms/code_generator diff --git a/research/endomorphisms/glv.nim b/research/endomorphisms/glv.nim index ccd11c9a..c4f05e0d 100644 --- a/research/endomorphisms/glv.nim +++ b/research/endomorphisms/glv.nim @@ -6,10 +6,10 @@ # Armando Faz-Hernández, Patrick Longa, Ana H. Sánchez, 2013 # https://eprint.iacr.org/2013/158.pdf -import ../../constantine/math/elliptic/ec_endomorphism_accel {.all.}, - ../../constantine/platforms/abstractions, - ../../constantine/math/io/io_bigints, - ../../constantine/math/arithmetic +import constantine/math/elliptic/ec_endomorphism_accel {.all.}, + constantine/platforms/abstractions, + constantine/math/io/io_bigints, + constantine/math/arithmetic proc toString(glvSac: GLV_SAC): string = for j in 0 ..< glvSac.M: @@ -262,4 +262,4 @@ proc mainFullMulWindowed() = echo Q -mainFullMulWindowed() \ No newline at end of file +mainFullMulWindowed() diff --git a/research/kzg/fft_fr.nim b/research/kzg/fft_fr.nim index 57b5a031..ac68fa12 100644 --- a/research/kzg/fft_fr.nim +++ b/research/kzg/fft_fr.nim @@ -7,10 +7,10 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../../constantine/platforms/primitives, - ../../constantine/math/config/curves, - ../../constantine/math/arithmetic, - ../../constantine/math/io/io_fields, + constantine/platforms/primitives, + constantine/named/algebra, + constantine/math/arithmetic, + constantine/math/io/io_fields, # Research ./strided_views, ./fft_lut @@ -195,7 +195,7 @@ proc init*(T: type FFTDescriptor, maxScale: uint8): T = when isMainModule: import std/[times, monotimes, strformat], - ../../helpers/prng_unsafe + helpers/prng_unsafe proc roundtrip() = let fftDesc = FFTDescriptor[Fr[BLS12_381]].init(maxScale = 4) diff --git a/research/kzg/fft_g1.nim b/research/kzg/fft_g1.nim index b4e518ff..dac01faf 100644 --- a/research/kzg/fft_g1.nim +++ b/research/kzg/fft_g1.nim @@ -7,12 +7,12 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../../constantine/platforms/primitives, - ../../constantine/math/config/curves, - ../../constantine/math/arithmetic, - ../../constantine/math/ec_shortweierstrass, - ../../constantine/math/elliptic/ec_scalar_mul_vartime, - ../../constantine/math/io/[io_fields, io_ec, io_bigints], + constantine/platforms/primitives, + constantine/named/algebra, + constantine/math/arithmetic, + constantine/math/ec_shortweierstrass, + constantine/math/elliptic/ec_scalar_mul_vartime, + constantine/math/io/[io_fields, io_ec, io_bigints], # Research ./strided_views, ./fft_lut @@ -206,7 +206,7 @@ proc init*(T: type FFTDescriptor, maxScale: uint8): T = when isMainModule: import std/[times, monotimes, strformat], - ../../helpers/prng_unsafe + helpers/prng_unsafe type EC_G1 = ECP_ShortW_Prj[Fp[BLS12_381], G1] var Generator1: ECP_ShortW_Aff[Fp[BLS12_381], G1] diff --git a/research/kzg/fft_lut.nim b/research/kzg/fft_lut.nim index b524938f..cc91d909 100644 --- a/research/kzg/fft_lut.nim +++ b/research/kzg/fft_lut.nim @@ -8,10 +8,10 @@ import std/macros, - ../../constantine/platforms/abstractions, - ../../constantine/math/config/curves, - ../../constantine/math/arithmetic, - ../../constantine/math/io/io_fields + constantine/platforms/abstractions, + constantine/named/algebra, + constantine/math/arithmetic, + constantine/math/io/io_fields # TODO automate this # we can precompute everything in Sage diff --git a/research/kzg/kzg_single_proofs.nim b/research/kzg/kzg_single_proofs.nim index 51811212..3865dc36 100644 --- a/research/kzg/kzg_single_proofs.nim +++ b/research/kzg/kzg_single_proofs.nim @@ -1,15 +1,15 @@ # https://github.com/ethereum/research/blob/master/kzg_data_availability/kzg_proofs.py import - ../../constantine/math/config/curves, - ../../constantine/math/[arithmetic, primitives, extension_fields], - ../../constantine/math/elliptic/[ + constantine/named/algebra, + constantine/math/[arithmetic, primitives, extension_fields], + constantine/math/elliptic/[ ec_scalar_mul, ec_shortweierstrass_affine, ec_shortweierstrass_projective, ], - ../../constantine/math/io/[io_fields, io_ec], - ../../constantine/math/pairings/[ + constantine/math/io/[io_fields, io_ec], + constantine/math/pairings/[ pairings_bls12, miller_loops ], diff --git a/research/kzg/polynomials.nim b/research/kzg/polynomials.nim index 4fd6e057..fd6c2c6e 100644 --- a/research/kzg/polynomials.nim +++ b/research/kzg/polynomials.nim @@ -1,14 +1,14 @@ import - ../../constantine/platforms/primitives, - ../../constantine/math/config/curves, - ../../constantine/math/[arithmetic, extension_fields], - ../../constantine/math/elliptic/[ + constantine/platforms/primitives, + constantine/named/algebra, + constantine/math/[arithmetic, extension_fields], + constantine/math/elliptic/[ ec_scalar_mul, ec_shortweierstrass_affine, ec_shortweierstrass_projective, ], - ../../constantine/math/io/[io_fields, io_ec], - ../../constantine/math/pairings/[ + constantine/math/io/[io_fields, io_ec], + constantine/math/pairings/[ pairing_bls12, miller_loops, cyclotomic_subgroups diff --git a/sage/derive_endomorphisms.sage b/sage/derive_endomorphisms.sage index 5e702605..0f17413c 100644 --- a/sage/derive_endomorphisms.sage +++ b/sage/derive_endomorphisms.sage @@ -267,8 +267,8 @@ if __name__ == "__main__": f.write('\n\n') f.write(inspect.cleandoc(f""" import - ../config/curves, - ../io/[io_bigints, io_fields] + constantine/named/algebra, + constantine/math/io/[io_bigints, io_fields] # {curve} G1 # ------------------------------------------------------------ diff --git a/sage/derive_frobenius.sage b/sage/derive_frobenius.sage index 96ed47a4..12932644 100644 --- a/sage/derive_frobenius.sage +++ b/sage/derive_frobenius.sage @@ -278,16 +278,16 @@ if __name__ == "__main__": if embdeg//twdeg >= 2: f.write(inspect.cleandoc(""" import - ../config/curves, - ../extension_fields, - ../io/io_extfields + constantine/named/algebra, + constantine/math/extension_fields, + constantine/math/io/io_extfields """)) else: f.write(inspect.cleandoc(""" import - ../config/curves, - ../extension_fields, - ../io/[io_fields, io_extfields] + constantine/named/algebra, + constantine/math/extension_fields, + constantine/math/io/[io_fields, io_extfields] """)) f.write('\n\n') f.write(FrobMap) diff --git a/sage/derive_hash_to_curve.sage b/sage/derive_hash_to_curve.sage index 5c20a905..ca6f0d09 100644 --- a/sage/derive_hash_to_curve.sage +++ b/sage/derive_hash_to_curve.sage @@ -734,8 +734,8 @@ if __name__ == "__main__": f.write(inspect.cleandoc(""" import - ../config/curves, - ../io/io_fields + constantine/named/algebra, + constantine/math/io/io_fields """)) f.write('\n\n') @@ -754,8 +754,8 @@ if __name__ == "__main__": f.write(inspect.cleandoc(""" import - ../config/curves, - ../io/[io_fields, io_extfields] + constantine/named/algebra, + constantine/math/io/[io_fields, io_extfields] """)) f.write('\n\n') @@ -775,8 +775,8 @@ if __name__ == "__main__": f.write(inspect.cleandoc(""" import - ../config/curves, - ../io/io_fields + constantine/named/algebra, + constantine/math/io/io_fields """)) f.write('\n\n') @@ -800,8 +800,8 @@ if __name__ == "__main__": f.write(inspect.cleandoc(""" import - ../config/curves, - ../io/[io_fields, io_extfields] + constantine/named/algebra, + constantine/math/io/[io_fields, io_extfields] """)) f.write('\n\n') diff --git a/sage/derive_pairing.sage b/sage/derive_pairing.sage index 6d6be9de..5ff35980 100644 --- a/sage/derive_pairing.sage +++ b/sage/derive_pairing.sage @@ -236,8 +236,8 @@ if __name__ == "__main__": f.write('\n\n') f.write(inspect.cleandoc(""" import - ../config/curves, - ../io/io_bigints + constantine/named/algebra, + constantine/math/io/io_bigints # Slow generic implementation # ------------------------------------------------------------ diff --git a/sage/derive_square_root.sage b/sage/derive_square_root.sage index 3ea7256d..5856e798 100644 --- a/sage/derive_square_root.sage +++ b/sage/derive_square_root.sage @@ -138,8 +138,8 @@ if __name__ == "__main__": f.write(inspect.cleandoc(""" import - ../config/curves, - ../io/io_extfields + constantine/named/algebra, + constantine/math/io/io_extfields """)) f.write('\n\n') diff --git a/sage/ethereum_kzg.sage b/sage/ethereum_kzg.sage index 2859ebfb..5664ee38 100644 --- a/sage/ethereum_kzg.sage +++ b/sage/ethereum_kzg.sage @@ -92,8 +92,8 @@ if __name__ == "__main__": f.write('\n\n') f.write(inspect.cleandoc(f""" import - ../config/curves, - ../io/io_bigints + constantine/named/algebra, + constantine/math/io/io_bigints # Roots of unity # ------------------------------------------------------------ @@ -106,4 +106,4 @@ if __name__ == "__main__": 'ctt_eth_kzg_bls12_381_fr_pow2_roots_of_unity', dumpRoots(gen_pow2_roots_of_unity(Fr, 32)) )) - f.write('\n\n') \ No newline at end of file + f.write('\n\n') diff --git a/sage/g2_params.sage b/sage/g2_params.sage index dc717c94..5781e404 100644 --- a/sage/g2_params.sage +++ b/sage/g2_params.sage @@ -166,8 +166,8 @@ if __name__ == "__main__": f.write(inspect.cleandoc(""" import - ../config/curves, - ../io/[io_fields, io_extfields] + constantine/named/algebra, + constantine/math/io/[io_fields, io_extfields] """)) f.write('\n\n') diff --git a/tests/gpu/hello_world_llvm.nim b/tests/gpu/hello_world_llvm.nim index 6e3f310a..d79f133c 100644 --- a/tests/gpu/hello_world_llvm.nim +++ b/tests/gpu/hello_world_llvm.nim @@ -6,7 +6,7 @@ # * Apache v2 license (license terms in the root directory or at http://www.apache.org/licenses/LICENSE-2.0). # at your option. This file may not be copied, modified, or distributed except according to those terms. -import ../../constantine/platforms/code_generator/llvm +import constantine/platforms/code_generator/llvm echo "LLVM JIT compiler Hello World" @@ -45,4 +45,4 @@ block: builder.dispose() engine.dispose() # also destroys the module attached to it ctx.dispose() -echo "LLVM JIT - SUCCESS" \ No newline at end of file +echo "LLVM JIT - SUCCESS" diff --git a/tests/gpu/hello_world_nvidia.nim b/tests/gpu/hello_world_nvidia.nim index ae98954e..1eaa4fee 100644 --- a/tests/gpu/hello_world_nvidia.nim +++ b/tests/gpu/hello_world_nvidia.nim @@ -6,7 +6,7 @@ # * Apache v2 license (license terms in the root directory or at http://www.apache.org/licenses/LICENSE-2.0). # at your option. This file may not be copied, modified, or distributed except according to those terms. -import ../../constantine/platforms/code_generator/[llvm, nvidia, bindings/c_abi] +import constantine/platforms/code_generator/[llvm, nvidia, bindings/c_abi] # ############################################################ # diff --git a/tests/gpu/t_nvidia_fp.nim b/tests/gpu/t_nvidia_fp.nim index 7107a076..a441e92d 100644 --- a/tests/gpu/t_nvidia_fp.nim +++ b/tests/gpu/t_nvidia_fp.nim @@ -11,14 +11,14 @@ import # Standard library std/[unittest, times], # Internal - ../../constantine/platforms/code_generator/[llvm, nvidia, ir], - ../../constantine/platforms/static_for, - ../../constantine/math/config/curves, - ../../constantine/math/io/io_bigints, - ../../constantine/math/arithmetic, - ../../constantine/math_codegen/fields_nvidia, + constantine/platforms/code_generator/[llvm, nvidia, ir], + constantine/platforms/static_for, + constantine/named/algebra, + constantine/math/io/io_bigints, + constantine/math/arithmetic, + constantine/math_compiler/fields_nvidia, # Test utilities - ../../helpers/prng_unsafe + helpers/prng_unsafe var rng: RngState let seed = uint32(getTime().toUnix() and (1'i64 shl 32 - 1)) # unixTime mod 2^32 @@ -261,4 +261,4 @@ proc main() = test "Nvidia GPU field multiplication (𝔽p, 𝔽r) for " & $curve: t_field_mul(curve) -main() \ No newline at end of file +main() diff --git a/tests/math_arbitrary_precision/t_bigints_mod.nim b/tests/math_arbitrary_precision/t_bigints_mod.nim index 6c17f3ca..6932c670 100644 --- a/tests/math_arbitrary_precision/t_bigints_mod.nim +++ b/tests/math_arbitrary_precision/t_bigints_mod.nim @@ -1,11 +1,11 @@ # From issue #241 import - ../../constantine/math/[ + constantine/math/[ arithmetic, io/io_bigints], - ../../constantine/math_arbitrary_precision/arithmetic/limbs_divmod_vartime, - ../../constantine/platforms/abstractions + constantine/math_arbitrary_precision/arithmetic/limbs_divmod_vartime, + constantine/platforms/abstractions let a = BigInt[64].fromUint(0xa0e5cb56a1c08396'u64) let M = BigInt[64].fromUint(0xae57180eceb0206f'u64) @@ -20,4 +20,4 @@ let rBase = cast[BaseType](0xa0e5cb56a1c08396'u64) mod cast[BaseType](0xae57180e doAssert rBase == a.limbs[0].BaseType doAssert bool(a == r) -echo "SUCCESS: t_bigints_mod.nim" \ No newline at end of file +echo "SUCCESS: t_bigints_mod.nim" diff --git a/tests/math_arbitrary_precision/t_bigints_mod_vs_gmp.nim b/tests/math_arbitrary_precision/t_bigints_mod_vs_gmp.nim index 8b1e7b82..019d3f49 100644 --- a/tests/math_arbitrary_precision/t_bigints_mod_vs_gmp.nim +++ b/tests/math_arbitrary_precision/t_bigints_mod_vs_gmp.nim @@ -12,12 +12,12 @@ import # Third-party gmp, # Internal - ../../constantine/math/[arithmetic, io/io_bigints], - ../../constantine/platforms/primitives, - ../../constantine/serialization/codecs, - ../../constantine/math_arbitrary_precision/arithmetic/limbs_divmod_vartime, + constantine/math/[arithmetic, io/io_bigints], + constantine/platforms/primitives, + constantine/serialization/codecs, + constantine/math_arbitrary_precision/arithmetic/limbs_divmod_vartime, # Test utilities - ../../helpers/prng_unsafe + helpers/prng_unsafe echo "\n------------------------------------------------------\n" # We test up to 1024-bit, more is really slow diff --git a/tests/math_arbitrary_precision/t_bigints_powmod_vs_gmp.nim b/tests/math_arbitrary_precision/t_bigints_powmod_vs_gmp.nim index cc5f20ea..da03b40d 100644 --- a/tests/math_arbitrary_precision/t_bigints_powmod_vs_gmp.nim +++ b/tests/math_arbitrary_precision/t_bigints_powmod_vs_gmp.nim @@ -7,10 +7,10 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../../constantine/math_arbitrary_precision/arithmetic/[bigints_views, limbs_views], - ../../constantine/platforms/abstractions, - ../../constantine/serialization/codecs, - ../../helpers/prng_unsafe, + constantine/math_arbitrary_precision/arithmetic/[bigints_views, limbs_views], + constantine/platforms/abstractions, + constantine/serialization/codecs, + helpers/prng_unsafe, std/[times, strformat], gmp @@ -109,4 +109,4 @@ proc test(rng: var RngState) = for _ in 0 ..< Iters: rng.test() stdout.write'.' -stdout.write'\n' \ No newline at end of file +stdout.write'\n' diff --git a/tests/math_bigints/support/canaries.nim b/tests/math_bigints/support/canaries.nim index 17020321..154fca56 100644 --- a/tests/math_bigints/support/canaries.nim +++ b/tests/math_bigints/support/canaries.nim @@ -7,10 +7,10 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../../../constantine/platforms/abstractions, - ../../../constantine/math/arithmetic/bigints, - ../../../constantine/math/config/curves, - ../../../constantine/math/elliptic/[ec_shortweierstrass_affine, ec_shortweierstrass_projective] + constantine/platforms/abstractions, + constantine/math/arithmetic/bigints, + constantine/named/algebra, + constantine/math/elliptic/[ec_shortweierstrass_affine, ec_shortweierstrass_projective] # Canaries # -------------------------------------------------------------- diff --git a/tests/math_bigints/t_bigints.nim b/tests/math_bigints/t_bigints.nim index 99761268..afe7f4e5 100644 --- a/tests/math_bigints/t_bigints.nim +++ b/tests/math_bigints/t_bigints.nim @@ -10,9 +10,9 @@ import # Standard library std/unittest, # Internal - ../../constantine/math/io/io_bigints, - ../../constantine/math/arithmetic, - ../../constantine/platforms/abstractions, + constantine/math/io/io_bigints, + constantine/math/arithmetic, + constantine/platforms/abstractions, # Test utilities, support/canaries diff --git a/tests/math_bigints/t_bigints_mul_high_words_vs_gmp.nim b/tests/math_bigints/t_bigints_mul_high_words_vs_gmp.nim index eecff7ae..327e8ead 100644 --- a/tests/math_bigints/t_bigints_mul_high_words_vs_gmp.nim +++ b/tests/math_bigints/t_bigints_mul_high_words_vs_gmp.nim @@ -12,11 +12,11 @@ import # Third-party gmp, # Internal - ../../constantine/math/io/io_bigints, - ../../constantine/math/arithmetic, - ../../constantine/platforms/abstractions, + constantine/math/io/io_bigints, + constantine/math/arithmetic, + constantine/platforms/abstractions, # Test utilities - ../../helpers/prng_unsafe + helpers/prng_unsafe echo "\n------------------------------------------------------\n" # We test up to 1024-bit, more is really slow diff --git a/tests/math_bigints/t_bigints_mul_vs_gmp.nim b/tests/math_bigints/t_bigints_mul_vs_gmp.nim index a0c5a7f5..36eb55db 100644 --- a/tests/math_bigints/t_bigints_mul_vs_gmp.nim +++ b/tests/math_bigints/t_bigints_mul_vs_gmp.nim @@ -12,12 +12,12 @@ import # Third-party gmp, # Internal - ../../constantine/math/io/io_bigints, - ../../constantine/math/arithmetic, - ../../constantine/platforms/abstractions, + constantine/math/io/io_bigints, + constantine/math/arithmetic, + constantine/platforms/abstractions, # Test utilities - ../../constantine/serialization/codecs, - ../../helpers/prng_unsafe + constantine/serialization/codecs, + helpers/prng_unsafe echo "\n------------------------------------------------------\n" # We test up to 1024-bit, more is really slow diff --git a/tests/math_bigints/t_bigints_multimod.nim b/tests/math_bigints/t_bigints_multimod.nim index 64514b32..53ada84a 100644 --- a/tests/math_bigints/t_bigints_multimod.nim +++ b/tests/math_bigints/t_bigints_multimod.nim @@ -10,9 +10,9 @@ import # Standard library std/unittest, # Third-party - ../../constantine/platforms/abstractions, - ../../constantine/math/io/io_bigints, - ../../constantine/math/arithmetic + constantine/platforms/abstractions, + constantine/math/io/io_bigints, + constantine/math/arithmetic echo "\n------------------------------------------------------\n" diff --git a/tests/math_bigints/t_io_bigints.nim b/tests/math_bigints/t_io_bigints.nim index e43c3d2b..eabaf8af 100644 --- a/tests/math_bigints/t_io_bigints.nim +++ b/tests/math_bigints/t_io_bigints.nim @@ -7,10 +7,10 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import std/[unittest,times], - ../../constantine/math/io/io_bigints, - ../../constantine/platforms/abstractions, - ../../constantine/math/arithmetic, - ../../helpers/prng_unsafe + constantine/math/io/io_bigints, + constantine/platforms/abstractions, + constantine/math/arithmetic, + helpers/prng_unsafe # Random seed for reproducibility var rng: RngState diff --git a/tests/math_elliptic_curves/t_ec_conversion.nim b/tests/math_elliptic_curves/t_ec_conversion.nim index 0e9dcf01..2fb3f3bf 100644 --- a/tests/math_elliptic_curves/t_ec_conversion.nim +++ b/tests/math_elliptic_curves/t_ec_conversion.nim @@ -8,9 +8,9 @@ import # Internals - ../../constantine/math/config/curves, - ../../constantine/math/elliptic/[ec_shortweierstrass_jacobian, ec_shortweierstrass_projective], - ../../constantine/math/extension_fields, + constantine/named/algebra, + constantine/math/elliptic/[ec_shortweierstrass_jacobian, ec_shortweierstrass_projective], + constantine/math/extension_fields, # Test utilities ./t_ec_template @@ -60,4 +60,4 @@ run_EC_affine_conversion( ec = ECP_ShortW_Prj[Fp2[BLS12_381], G2], Iters = Iters, moduleName = "test_ec_conversion_shortw_affine_projective_g2_" & $BLS12_381 - ) \ No newline at end of file + ) diff --git a/tests/math_elliptic_curves/t_ec_frobenius.nim b/tests/math_elliptic_curves/t_ec_frobenius.nim index 2d185fa0..9e7d308d 100644 --- a/tests/math_elliptic_curves/t_ec_frobenius.nim +++ b/tests/math_elliptic_curves/t_ec_frobenius.nim @@ -11,14 +11,14 @@ import # Standard library std/[times, unittest], # Internals - ../../constantine/platforms/abstractions, - ../../constantine/math/config/curves, - ../../constantine/math/[arithmetic, extension_fields], - ../../constantine/math/io/[io_bigints, io_ec], - ../../constantine/math/elliptic/[ec_shortweierstrass_affine, ec_shortweierstrass_projective, ec_scalar_mul], - ../../constantine/math/isogenies/frobenius, + constantine/platforms/abstractions, + constantine/named/algebra, + constantine/math/[arithmetic, extension_fields], + constantine/math/io/[io_bigints, io_ec], + constantine/math/elliptic/[ec_shortweierstrass_affine, ec_shortweierstrass_projective, ec_scalar_mul], + constantine/math/isogenies/frobenius, # Tests - ../../helpers/prng_unsafe, + helpers/prng_unsafe, ./t_ec_template echo "\n------------------------------------------------------\n" diff --git a/tests/math_elliptic_curves/t_ec_sage_bls12_377.nim b/tests/math_elliptic_curves/t_ec_sage_bls12_377.nim index f5764e67..511afff5 100644 --- a/tests/math_elliptic_curves/t_ec_sage_bls12_377.nim +++ b/tests/math_elliptic_curves/t_ec_sage_bls12_377.nim @@ -8,10 +8,10 @@ import # Internals - ../../constantine/math/config/curves, - ../../constantine/math/extension_fields, - ../../constantine/math/elliptic/ec_shortweierstrass_jacobian, - ../../constantine/math/elliptic/ec_shortweierstrass_projective, + constantine/named/algebra, + constantine/math/extension_fields, + constantine/math/elliptic/ec_shortweierstrass_jacobian, + constantine/math/elliptic/ec_shortweierstrass_projective, # Test utilities ./t_ec_sage_template diff --git a/tests/math_elliptic_curves/t_ec_sage_bls12_381.nim b/tests/math_elliptic_curves/t_ec_sage_bls12_381.nim index 38e04650..905f6fac 100644 --- a/tests/math_elliptic_curves/t_ec_sage_bls12_381.nim +++ b/tests/math_elliptic_curves/t_ec_sage_bls12_381.nim @@ -8,10 +8,10 @@ import # Internals - ../../constantine/math/config/curves, - ../../constantine/math/extension_fields, - ../../constantine/math/elliptic/ec_shortweierstrass_jacobian, - ../../constantine/math/elliptic/ec_shortweierstrass_projective, + constantine/named/algebra, + constantine/math/extension_fields, + constantine/math/elliptic/ec_shortweierstrass_jacobian, + constantine/math/elliptic/ec_shortweierstrass_projective, # Test utilities ./t_ec_sage_template diff --git a/tests/math_elliptic_curves/t_ec_sage_bn254_nogami.nim b/tests/math_elliptic_curves/t_ec_sage_bn254_nogami.nim index 89b07d63..c59ba7fe 100644 --- a/tests/math_elliptic_curves/t_ec_sage_bn254_nogami.nim +++ b/tests/math_elliptic_curves/t_ec_sage_bn254_nogami.nim @@ -8,10 +8,10 @@ import # Internals - ../../constantine/math/config/curves, - ../../constantine/math/extension_fields, - ../../constantine/math/elliptic/ec_shortweierstrass_jacobian, - ../../constantine/math/elliptic/ec_shortweierstrass_projective, + constantine/named/algebra, + constantine/math/extension_fields, + constantine/math/elliptic/ec_shortweierstrass_jacobian, + constantine/math/elliptic/ec_shortweierstrass_projective, # Test utilities ./t_ec_sage_template diff --git a/tests/math_elliptic_curves/t_ec_sage_bn254_snarks.nim b/tests/math_elliptic_curves/t_ec_sage_bn254_snarks.nim index 761d642b..0b7cd14e 100644 --- a/tests/math_elliptic_curves/t_ec_sage_bn254_snarks.nim +++ b/tests/math_elliptic_curves/t_ec_sage_bn254_snarks.nim @@ -8,10 +8,10 @@ import # Internals - ../../constantine/math/config/curves, - ../../constantine/math/extension_fields, - ../../constantine/math/elliptic/ec_shortweierstrass_jacobian, - ../../constantine/math/elliptic/ec_shortweierstrass_projective, + constantine/named/algebra, + constantine/math/extension_fields, + constantine/math/elliptic/ec_shortweierstrass_jacobian, + constantine/math/elliptic/ec_shortweierstrass_projective, # Test utilities ./t_ec_sage_template diff --git a/tests/math_elliptic_curves/t_ec_sage_bw6_761_g1.nim b/tests/math_elliptic_curves/t_ec_sage_bw6_761_g1.nim index 94862acb..f6204ff1 100644 --- a/tests/math_elliptic_curves/t_ec_sage_bw6_761_g1.nim +++ b/tests/math_elliptic_curves/t_ec_sage_bw6_761_g1.nim @@ -8,9 +8,9 @@ import # Internals - ../../constantine/math/config/[type_ff, curves], - ../../constantine/math/elliptic/ec_shortweierstrass_jacobian, - ../../constantine/math/elliptic/ec_shortweierstrass_projective, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_jacobian, + constantine/math/elliptic/ec_shortweierstrass_projective, # Test utilities ./t_ec_sage_template diff --git a/tests/math_elliptic_curves/t_ec_sage_bw6_761_g2.nim b/tests/math_elliptic_curves/t_ec_sage_bw6_761_g2.nim index 45cb27aa..734802c2 100644 --- a/tests/math_elliptic_curves/t_ec_sage_bw6_761_g2.nim +++ b/tests/math_elliptic_curves/t_ec_sage_bw6_761_g2.nim @@ -8,9 +8,9 @@ import # Internals - ../../constantine/math/config/[type_ff, curves], - ../../constantine/math/elliptic/ec_shortweierstrass_jacobian, - ../../constantine/math/elliptic/ec_shortweierstrass_projective, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_jacobian, + constantine/math/elliptic/ec_shortweierstrass_projective, # Test utilities ./t_ec_sage_template diff --git a/tests/math_elliptic_curves/t_ec_sage_pallas.nim b/tests/math_elliptic_curves/t_ec_sage_pallas.nim index 43bcc31f..48adb443 100644 --- a/tests/math_elliptic_curves/t_ec_sage_pallas.nim +++ b/tests/math_elliptic_curves/t_ec_sage_pallas.nim @@ -8,10 +8,10 @@ import # Internals - ../../constantine/math/config/curves, - ../../constantine/math/extension_fields, - ../../constantine/math/elliptic/ec_shortweierstrass_jacobian, - ../../constantine/math/elliptic/ec_shortweierstrass_projective, + constantine/named/algebra, + constantine/math/extension_fields, + constantine/math/elliptic/ec_shortweierstrass_jacobian, + constantine/math/elliptic/ec_shortweierstrass_projective, # Test utilities ./t_ec_sage_template @@ -24,4 +24,4 @@ staticFor(bits, [Pallas.getCurveOrderBitwidth()]): run_scalar_mul_test_vs_sage( ECP_ShortW_Jac[Fp[Pallas], G1], bits, "t_ec_sage_pallas_g1_jacobian" - ) \ No newline at end of file + ) diff --git a/tests/math_elliptic_curves/t_ec_sage_template.nim b/tests/math_elliptic_curves/t_ec_sage_template.nim index 7d155cf9..486235a2 100644 --- a/tests/math_elliptic_curves/t_ec_sage_template.nim +++ b/tests/math_elliptic_curves/t_ec_sage_template.nim @@ -12,18 +12,18 @@ import # 3rd party pkg/jsony, # Internals - ../../constantine/platforms/abstractions, - ../../constantine/math/[arithmetic, extension_fields], - ../../constantine/math/io/[io_bigints, io_ec], - ../../constantine/math/elliptic/[ + constantine/platforms/abstractions, + constantine/math/[arithmetic, extension_fields], + constantine/math/io/[io_bigints, io_ec], + constantine/math/elliptic/[ ec_shortweierstrass_affine, ec_shortweierstrass_projective, ec_shortweierstrass_jacobian, ec_scalar_mul, ec_endomorphism_accel], - ../../constantine/math/constants/zoo_endomorphisms, + constantine/named/zoo_endomorphisms, # Test utilities - ../../constantine/math/elliptic/ec_scalar_mul_vartime + constantine/math/elliptic/ec_scalar_mul_vartime export unittest, abstractions, arithmetic # Generic sandwich @@ -190,4 +190,4 @@ proc run_scalar_mul_test_vs_sage*( staticFor w, 2, 5: var endoWNAF = P endoWNAF.scalarMulEndo_minHammingWeight_windowed_vartime(vec.vectors[i].scalar, window = w) - check: bool(impl == endoWNAF) \ No newline at end of file + check: bool(impl == endoWNAF) diff --git a/tests/math_elliptic_curves/t_ec_sage_vesta.nim b/tests/math_elliptic_curves/t_ec_sage_vesta.nim index 29f215c0..6343565f 100644 --- a/tests/math_elliptic_curves/t_ec_sage_vesta.nim +++ b/tests/math_elliptic_curves/t_ec_sage_vesta.nim @@ -8,10 +8,10 @@ import # Internals - ../../constantine/math/config/curves, - ../../constantine/math/extension_fields, - ../../constantine/math/elliptic/ec_shortweierstrass_jacobian, - ../../constantine/math/elliptic/ec_shortweierstrass_projective, + constantine/named/algebra, + constantine/math/extension_fields, + constantine/math/elliptic/ec_shortweierstrass_jacobian, + constantine/math/elliptic/ec_shortweierstrass_projective, # Test utilities ./t_ec_sage_template diff --git a/tests/math_elliptic_curves/t_ec_shortw_jac_g1_add_double.nim b/tests/math_elliptic_curves/t_ec_shortw_jac_g1_add_double.nim index 76acc72a..84d7332d 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_jac_g1_add_double.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_jac_g1_add_double.nim @@ -8,8 +8,8 @@ import # Internals - ../../constantine/math/config/[type_ff, curves], - ../../constantine/math/elliptic/ec_shortweierstrass_jacobian, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_jacobian, # Test utilities ./t_ec_template @@ -86,4 +86,4 @@ run_EC_addition_vartime_tests( ec = ECP_ShortW_Jac[Fp[Vesta], G1], Iters = Iters, moduleName = "test_ec_shortweierstrass_jacobian_g1_add_double_vartime_" & $Vesta - ) \ No newline at end of file + ) diff --git a/tests/math_elliptic_curves/t_ec_shortw_jac_g1_mixed_add.nim b/tests/math_elliptic_curves/t_ec_shortw_jac_g1_mixed_add.nim index 6099f0a0..18df007b 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_jac_g1_mixed_add.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_jac_g1_mixed_add.nim @@ -8,9 +8,9 @@ import # Internals - ../../constantine/math/config/curves, - ../../constantine/math/elliptic/ec_shortweierstrass_jacobian, - ../../constantine/math/arithmetic, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_jacobian, + constantine/math/arithmetic, # Test utilities ./t_ec_template diff --git a/tests/math_elliptic_curves/t_ec_shortw_jac_g1_msm.nim b/tests/math_elliptic_curves/t_ec_shortw_jac_g1_msm.nim index 1e1fa8ee..02da9a46 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_jac_g1_msm.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_jac_g1_msm.nim @@ -8,9 +8,9 @@ import # Internals - ../../constantine/math/config/curves, - ../../constantine/math/elliptic/ec_shortweierstrass_jacobian, - ../../constantine/math/arithmetic, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_jacobian, + constantine/math/arithmetic, # Test utilities ./t_ec_template diff --git a/tests/math_elliptic_curves/t_ec_shortw_jac_g1_mul_distri.nim b/tests/math_elliptic_curves/t_ec_shortw_jac_g1_mul_distri.nim index 8be095b1..b9d90a94 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_jac_g1_mul_distri.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_jac_g1_mul_distri.nim @@ -8,8 +8,8 @@ import # Internals - ../../constantine/math/config/[type_ff, curves], - ../../constantine/math/elliptic/ec_shortweierstrass_jacobian, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_jacobian, # Test utilities ./t_ec_template diff --git a/tests/math_elliptic_curves/t_ec_shortw_jac_g1_mul_sanity.nim b/tests/math_elliptic_curves/t_ec_shortw_jac_g1_mul_sanity.nim index e30c9090..2ce13a26 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_jac_g1_mul_sanity.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_jac_g1_mul_sanity.nim @@ -10,13 +10,13 @@ import # Standard library std/[unittest, times], # Internals - ../../constantine/math/config/curves, - ../../constantine/math/arithmetic, - ../../constantine/math/io/io_fields, - ../../constantine/math/elliptic/[ec_shortweierstrass_affine, ec_shortweierstrass_jacobian, ec_scalar_mul], + constantine/named/algebra, + constantine/math/arithmetic, + constantine/math/io/io_fields, + constantine/math/elliptic/[ec_shortweierstrass_affine, ec_shortweierstrass_jacobian, ec_scalar_mul], # Test utilities - ../../helpers/prng_unsafe, - ../../constantine/math/elliptic/ec_scalar_mul_vartime, + helpers/prng_unsafe, + constantine/math/elliptic/ec_scalar_mul_vartime, ./t_ec_template const diff --git a/tests/math_elliptic_curves/t_ec_shortw_jac_g1_mul_vs_ref.nim b/tests/math_elliptic_curves/t_ec_shortw_jac_g1_mul_vs_ref.nim index 6d336817..2d2129fd 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_jac_g1_mul_vs_ref.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_jac_g1_mul_vs_ref.nim @@ -8,8 +8,8 @@ import # Internals - ../../constantine/math/config/[type_ff, curves], - ../../constantine/math/elliptic/ec_shortweierstrass_jacobian, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_jacobian, # Test utilities ./t_ec_template diff --git a/tests/math_elliptic_curves/t_ec_shortw_jac_g1_sum_reduce.nim b/tests/math_elliptic_curves/t_ec_shortw_jac_g1_sum_reduce.nim index 13630242..cc62c890 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_jac_g1_sum_reduce.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_jac_g1_sum_reduce.nim @@ -8,9 +8,9 @@ import # Internals - ../../constantine/math/config/curves, - ../../constantine/math/elliptic/ec_shortweierstrass_jacobian, - ../../constantine/math/arithmetic, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_jacobian, + constantine/math/arithmetic, # Test utilities ./t_ec_template diff --git a/tests/math_elliptic_curves/t_ec_shortw_jac_g2_add_double_bls12_377.nim b/tests/math_elliptic_curves/t_ec_shortw_jac_g2_add_double_bls12_377.nim index 3c25bb44..49a859ba 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_jac_g2_add_double_bls12_377.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_jac_g2_add_double_bls12_377.nim @@ -8,9 +8,9 @@ import # Internals - ../../constantine/math/config/curves, - ../../constantine/math/elliptic/ec_shortweierstrass_jacobian, - ../../constantine/math/extension_fields, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_jacobian, + constantine/math/extension_fields, # Test utilities ./t_ec_template diff --git a/tests/math_elliptic_curves/t_ec_shortw_jac_g2_add_double_bls12_381.nim b/tests/math_elliptic_curves/t_ec_shortw_jac_g2_add_double_bls12_381.nim index fe6c0c85..c56ac2a1 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_jac_g2_add_double_bls12_381.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_jac_g2_add_double_bls12_381.nim @@ -8,9 +8,9 @@ import # Internals - ../../constantine/math/config/curves, - ../../constantine/math/elliptic/ec_shortweierstrass_jacobian, - ../../constantine/math/extension_fields, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_jacobian, + constantine/math/extension_fields, # Test utilities ./t_ec_template diff --git a/tests/math_elliptic_curves/t_ec_shortw_jac_g2_add_double_bn254_snarks.nim b/tests/math_elliptic_curves/t_ec_shortw_jac_g2_add_double_bn254_snarks.nim index e7bef556..9345918b 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_jac_g2_add_double_bn254_snarks.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_jac_g2_add_double_bn254_snarks.nim @@ -8,9 +8,9 @@ import # Internals - ../../constantine/math/config/curves, - ../../constantine/math/elliptic/ec_shortweierstrass_jacobian, - ../../constantine/math/extension_fields, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_jacobian, + constantine/math/extension_fields, # Test utilities ./t_ec_template diff --git a/tests/math_elliptic_curves/t_ec_shortw_jac_g2_add_double_bw6_761.nim b/tests/math_elliptic_curves/t_ec_shortw_jac_g2_add_double_bw6_761.nim index 50c1b2bd..7c8dd54e 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_jac_g2_add_double_bw6_761.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_jac_g2_add_double_bw6_761.nim @@ -8,8 +8,8 @@ import # Internals - ../../constantine/math/config/[type_ff, curves], - ../../constantine/math/elliptic/ec_shortweierstrass_jacobian, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_jacobian, # Test utilities ./t_ec_template diff --git a/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mixed_add_bls12_377.nim b/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mixed_add_bls12_377.nim index 16939c00..8403d14a 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mixed_add_bls12_377.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mixed_add_bls12_377.nim @@ -8,9 +8,9 @@ import # Internals - ../../constantine/math/config/curves, - ../../constantine/math/elliptic/ec_shortweierstrass_jacobian, - ../../constantine/math/extension_fields, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_jacobian, + constantine/math/extension_fields, # Test utilities ./t_ec_template diff --git a/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mixed_add_bls12_381.nim b/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mixed_add_bls12_381.nim index 5d838676..7f0973cd 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mixed_add_bls12_381.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mixed_add_bls12_381.nim @@ -8,9 +8,9 @@ import # Internals - ../../constantine/math/config/curves, - ../../constantine/math/elliptic/ec_shortweierstrass_jacobian, - ../../constantine/math/extension_fields, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_jacobian, + constantine/math/extension_fields, # Test utilities ./t_ec_template diff --git a/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mixed_add_bn254_snarks.nim b/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mixed_add_bn254_snarks.nim index 19a5f5c5..ac04830c 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mixed_add_bn254_snarks.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mixed_add_bn254_snarks.nim @@ -8,9 +8,9 @@ import # Internals - ../../constantine/math/config/curves, - ../../constantine/math/elliptic/ec_shortweierstrass_jacobian, - ../../constantine/math/extension_fields, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_jacobian, + constantine/math/extension_fields, # Test utilities ./t_ec_template diff --git a/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mixed_add_bw6_761.nim b/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mixed_add_bw6_761.nim index 37e5a32c..4dc02b37 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mixed_add_bw6_761.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mixed_add_bw6_761.nim @@ -8,8 +8,8 @@ import # Internals - ../../constantine/math/config/[type_ff, curves], - ../../constantine/math/elliptic/ec_shortweierstrass_jacobian, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_jacobian, # Test utilities ./t_ec_template diff --git a/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_distri_bls12_377.nim b/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_distri_bls12_377.nim index f14ac8c4..03ae19e8 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_distri_bls12_377.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_distri_bls12_377.nim @@ -8,9 +8,9 @@ import # Internals - ../../constantine/math/config/curves, - ../../constantine/math/elliptic/ec_shortweierstrass_jacobian, - ../../constantine/math/extension_fields, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_jacobian, + constantine/math/extension_fields, # Test utilities ./t_ec_template diff --git a/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_distri_bls12_381.nim b/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_distri_bls12_381.nim index e00fc765..d3d9606e 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_distri_bls12_381.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_distri_bls12_381.nim @@ -8,9 +8,9 @@ import # Internals - ../../constantine/math/config/curves, - ../../constantine/math/elliptic/ec_shortweierstrass_jacobian, - ../../constantine/math/extension_fields, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_jacobian, + constantine/math/extension_fields, # Test utilities ./t_ec_template diff --git a/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_distri_bn254_snarks.nim b/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_distri_bn254_snarks.nim index a655cbdf..8eca56b0 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_distri_bn254_snarks.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_distri_bn254_snarks.nim @@ -8,9 +8,9 @@ import # Internals - ../../constantine/math/config/curves, - ../../constantine/math/elliptic/ec_shortweierstrass_jacobian, - ../../constantine/math/extension_fields, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_jacobian, + constantine/math/extension_fields, # Test utilities ./t_ec_template diff --git a/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_distri_bw6_761.nim b/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_distri_bw6_761.nim index d5c44fe1..0ce8e307 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_distri_bw6_761.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_distri_bw6_761.nim @@ -8,8 +8,8 @@ import # Internals - ../../constantine/math/config/[type_ff, curves], - ../../constantine/math/elliptic/ec_shortweierstrass_jacobian, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_jacobian, # Test utilities ./t_ec_template diff --git a/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_sanity_bls12_377.nim b/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_sanity_bls12_377.nim index c915196a..cad7688f 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_sanity_bls12_377.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_sanity_bls12_377.nim @@ -8,9 +8,9 @@ import # Internals - ../../constantine/math/config/curves, - ../../constantine/math/elliptic/ec_shortweierstrass_jacobian, - ../../constantine/math/extension_fields, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_jacobian, + constantine/math/extension_fields, # Test utilities ./t_ec_template diff --git a/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_sanity_bls12_381.nim b/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_sanity_bls12_381.nim index 7f3dbfe1..08b48385 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_sanity_bls12_381.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_sanity_bls12_381.nim @@ -8,9 +8,9 @@ import # Internals - ../../constantine/math/config/curves, - ../../constantine/math/elliptic/ec_shortweierstrass_jacobian, - ../../constantine/math/extension_fields, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_jacobian, + constantine/math/extension_fields, # Test utilities ./t_ec_template diff --git a/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_sanity_bn254_snarks.nim b/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_sanity_bn254_snarks.nim index 2a8587e4..3024d950 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_sanity_bn254_snarks.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_sanity_bn254_snarks.nim @@ -8,9 +8,9 @@ import # Internals - ../../constantine/math/config/curves, - ../../constantine/math/elliptic/ec_shortweierstrass_jacobian, - ../../constantine/math/extension_fields, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_jacobian, + constantine/math/extension_fields, # Test utilities ./t_ec_template diff --git a/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_sanity_bw6_761.nim b/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_sanity_bw6_761.nim index e8bced94..02aa2de5 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_sanity_bw6_761.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_sanity_bw6_761.nim @@ -8,8 +8,8 @@ import # Internals - ../../constantine/math/config/[type_ff, curves], - ../../constantine/math/elliptic/ec_shortweierstrass_jacobian, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_jacobian, # Test utilities ./t_ec_template diff --git a/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_vs_ref_bls12_377.nim b/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_vs_ref_bls12_377.nim index 3079d266..31220856 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_vs_ref_bls12_377.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_vs_ref_bls12_377.nim @@ -8,9 +8,9 @@ import # Internals - ../../constantine/math/config/curves, - ../../constantine/math/elliptic/ec_shortweierstrass_jacobian, - ../../constantine/math/extension_fields, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_jacobian, + constantine/math/extension_fields, # Test utilities ./t_ec_template diff --git a/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_vs_ref_bls12_381.nim b/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_vs_ref_bls12_381.nim index 7ae2b5fd..45b91a79 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_vs_ref_bls12_381.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_vs_ref_bls12_381.nim @@ -8,9 +8,9 @@ import # Internals - ../../constantine/math/config/curves, - ../../constantine/math/elliptic/ec_shortweierstrass_jacobian, - ../../constantine/math/extension_fields, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_jacobian, + constantine/math/extension_fields, # Test utilities ./t_ec_template diff --git a/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_vs_ref_bn254_snarks.nim b/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_vs_ref_bn254_snarks.nim index 5bebf669..1fb87d75 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_vs_ref_bn254_snarks.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_vs_ref_bn254_snarks.nim @@ -8,9 +8,9 @@ import # Internals - ../../constantine/math/config/curves, - ../../constantine/math/elliptic/ec_shortweierstrass_jacobian, - ../../constantine/math/extension_fields, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_jacobian, + constantine/math/extension_fields, # Test utilities ./t_ec_template diff --git a/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_vs_ref_bw6_761.nim b/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_vs_ref_bw6_761.nim index c18e5820..abd72a43 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_vs_ref_bw6_761.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_vs_ref_bw6_761.nim @@ -8,8 +8,8 @@ import # Internals - ../../constantine/math/config/[type_ff, curves], - ../../constantine/math/elliptic/ec_shortweierstrass_jacobian, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_jacobian, # Test utilities ./t_ec_template diff --git a/tests/math_elliptic_curves/t_ec_shortw_jacext_g1_add_double.nim b/tests/math_elliptic_curves/t_ec_shortw_jacext_g1_add_double.nim index 17d28f73..1febc0b4 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_jacext_g1_add_double.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_jacext_g1_add_double.nim @@ -8,8 +8,8 @@ import # Internals - ../../constantine/math/config/[type_ff, curves], - ../../constantine/math/elliptic/ec_shortweierstrass_jacobian_extended, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_jacobian_extended, # Test utilities ./t_ec_template diff --git a/tests/math_elliptic_curves/t_ec_shortw_jacext_g1_mixed_add.nim b/tests/math_elliptic_curves/t_ec_shortw_jacext_g1_mixed_add.nim index 540078bf..7a052b93 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_jacext_g1_mixed_add.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_jacext_g1_mixed_add.nim @@ -8,9 +8,9 @@ import # Internals - ../../constantine/math/config/curves, - ../../constantine/math/elliptic/ec_shortweierstrass_jacobian_extended, - ../../constantine/math/arithmetic, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_jacobian_extended, + constantine/math/arithmetic, # Test utilities ./t_ec_template diff --git a/tests/math_elliptic_curves/t_ec_shortw_jacext_g1_sum_reduce.nim b/tests/math_elliptic_curves/t_ec_shortw_jacext_g1_sum_reduce.nim index 5ebdc9a0..4d202c08 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_jacext_g1_sum_reduce.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_jacext_g1_sum_reduce.nim @@ -8,9 +8,9 @@ import # Internals - ../../constantine/math/config/curves, - ../../constantine/math/elliptic/ec_shortweierstrass_jacobian_extended, - ../../constantine/math/arithmetic, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_jacobian_extended, + constantine/math/arithmetic, # Test utilities ./t_ec_template diff --git a/tests/math_elliptic_curves/t_ec_shortw_prj_edge_case_345.nim b/tests/math_elliptic_curves/t_ec_shortw_prj_edge_case_345.nim index 8ecb7b4b..603e93b5 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_prj_edge_case_345.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_prj_edge_case_345.nim @@ -1,14 +1,14 @@ # https://github.com/mratsim/constantine/issues/345 -import ../../constantine/math/arithmetic -import ../../constantine/math/io/io_fields -import ../../constantine/math/io/io_bigints -import ../../constantine/math/config/curves -import ../../constantine/math/extension_fields/towers -import ../../constantine/math/elliptic/ec_shortweierstrass_affine -import ../../constantine/math/elliptic/ec_shortweierstrass_projective -import ../../constantine/math/elliptic/ec_scalar_mul -import ../../constantine/math/elliptic/ec_scalar_mul_vartime +import constantine/math/arithmetic +import constantine/math/io/io_fields +import constantine/math/io/io_bigints +import constantine/named/algebra +import constantine/math/extension_fields/towers +import constantine/math/elliptic/ec_shortweierstrass_affine +import constantine/math/elliptic/ec_shortweierstrass_projective +import constantine/math/elliptic/ec_scalar_mul +import constantine/math/elliptic/ec_scalar_mul_vartime #------------------------------------------------------------------------------- diff --git a/tests/math_elliptic_curves/t_ec_shortw_prj_edge_cases.nim b/tests/math_elliptic_curves/t_ec_shortw_prj_edge_cases.nim index 1fb7efbe..fce66835 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_prj_edge_cases.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_prj_edge_cases.nim @@ -16,12 +16,12 @@ import # Standard library std/unittest, # Internals - ../../constantine/platforms/abstractions, - ../../constantine/math/config/curves, - ../../constantine/math/arithmetic, - ../../constantine/math/extension_fields, - ../../constantine/math/io/[io_bigints, io_fields, io_extfields], - ../../constantine/math/elliptic/ec_shortweierstrass_projective + constantine/platforms/abstractions, + constantine/named/algebra, + constantine/math/arithmetic, + constantine/math/extension_fields, + constantine/math/io/[io_bigints, io_fields, io_extfields], + constantine/math/elliptic/ec_shortweierstrass_projective func testAddAssociativity[EC](a, b, c: EC) = var tmp1{.noInit.}, tmp2{.noInit.}: ECP_ShortW_Prj[Fp2[BLS12_381], G2] diff --git a/tests/math_elliptic_curves/t_ec_shortw_prj_g1_add_double.nim b/tests/math_elliptic_curves/t_ec_shortw_prj_g1_add_double.nim index f9651510..54042024 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_prj_g1_add_double.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_prj_g1_add_double.nim @@ -8,8 +8,9 @@ import # Internals - ../../constantine/math/config/[type_ff, curves], - ../../constantine/math/elliptic/ec_shortweierstrass_projective, + constantine/named/algebra, + constantine/platforms/type_ff, + constantine/math/elliptic/ec_shortweierstrass_projective, # Test utilities ./t_ec_template diff --git a/tests/math_elliptic_curves/t_ec_shortw_prj_g1_mixed_add.nim b/tests/math_elliptic_curves/t_ec_shortw_prj_g1_mixed_add.nim index 14a0aca5..8f500322 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_prj_g1_mixed_add.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_prj_g1_mixed_add.nim @@ -8,9 +8,9 @@ import # Internals - ../../constantine/math/config/curves, - ../../constantine/math/elliptic/ec_shortweierstrass_projective, - ../../constantine/math/arithmetic, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_projective, + constantine/math/arithmetic, # Test utilities ./t_ec_template diff --git a/tests/math_elliptic_curves/t_ec_shortw_prj_g1_msm.nim b/tests/math_elliptic_curves/t_ec_shortw_prj_g1_msm.nim index b9a93de9..6c75c8b4 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_prj_g1_msm.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_prj_g1_msm.nim @@ -8,9 +8,9 @@ import # Internals - ../../constantine/math/config/curves, - ../../constantine/math/elliptic/ec_shortweierstrass_projective, - ../../constantine/math/arithmetic, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_projective, + constantine/math/arithmetic, # Test utilities ./t_ec_template diff --git a/tests/math_elliptic_curves/t_ec_shortw_prj_g1_mul_distri.nim b/tests/math_elliptic_curves/t_ec_shortw_prj_g1_mul_distri.nim index 7bc56999..e883a12f 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_prj_g1_mul_distri.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_prj_g1_mul_distri.nim @@ -8,8 +8,8 @@ import # Internals - ../../constantine/math/config/[type_ff, curves], - ../../constantine/math/elliptic/ec_shortweierstrass_projective, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_projective, # Test utilities ./t_ec_template diff --git a/tests/math_elliptic_curves/t_ec_shortw_prj_g1_mul_sanity.nim b/tests/math_elliptic_curves/t_ec_shortw_prj_g1_mul_sanity.nim index 49469ae0..b5ec267f 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_prj_g1_mul_sanity.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_prj_g1_mul_sanity.nim @@ -10,12 +10,12 @@ import # Standard library std/[unittest, times], # Internals - ../../constantine/math/config/curves, - ../../constantine/math/io/io_fields, - ../../constantine/math/elliptic/[ec_shortweierstrass_affine, ec_shortweierstrass_projective, ec_scalar_mul], + constantine/named/algebra, + constantine/math/io/io_fields, + constantine/math/elliptic/[ec_shortweierstrass_affine, ec_shortweierstrass_projective, ec_scalar_mul], # Test utilities - ../../helpers/prng_unsafe, - ../../constantine/math/elliptic/ec_scalar_mul_vartime, + helpers/prng_unsafe, + constantine/math/elliptic/ec_scalar_mul_vartime, ./t_ec_template const diff --git a/tests/math_elliptic_curves/t_ec_shortw_prj_g1_mul_vs_ref.nim b/tests/math_elliptic_curves/t_ec_shortw_prj_g1_mul_vs_ref.nim index 9b607ede..3ca9baa6 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_prj_g1_mul_vs_ref.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_prj_g1_mul_vs_ref.nim @@ -8,8 +8,8 @@ import # Internals - ../../constantine/math/config/[type_ff, curves], - ../../constantine/math/elliptic/ec_shortweierstrass_projective, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_projective, # Test utilities ./t_ec_template diff --git a/tests/math_elliptic_curves/t_ec_shortw_prj_g1_sum_reduce.nim b/tests/math_elliptic_curves/t_ec_shortw_prj_g1_sum_reduce.nim index 752d0562..428cdfd2 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_prj_g1_sum_reduce.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_prj_g1_sum_reduce.nim @@ -8,9 +8,9 @@ import # Internals - ../../constantine/math/config/curves, - ../../constantine/math/elliptic/ec_shortweierstrass_projective, - ../../constantine/math/arithmetic, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_projective, + constantine/math/arithmetic, # Test utilities ./t_ec_template diff --git a/tests/math_elliptic_curves/t_ec_shortw_prj_g2_add_double_bls12_377.nim b/tests/math_elliptic_curves/t_ec_shortw_prj_g2_add_double_bls12_377.nim index 7f8b6828..7bf1fd49 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_prj_g2_add_double_bls12_377.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_prj_g2_add_double_bls12_377.nim @@ -8,9 +8,9 @@ import # Internals - ../../constantine/math/config/curves, - ../../constantine/math/elliptic/ec_shortweierstrass_projective, - ../../constantine/math/extension_fields, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_projective, + constantine/math/extension_fields, # Test utilities ./t_ec_template diff --git a/tests/math_elliptic_curves/t_ec_shortw_prj_g2_add_double_bls12_381.nim b/tests/math_elliptic_curves/t_ec_shortw_prj_g2_add_double_bls12_381.nim index 7c614d4d..da2c6fc7 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_prj_g2_add_double_bls12_381.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_prj_g2_add_double_bls12_381.nim @@ -8,9 +8,9 @@ import # Internals - ../../constantine/math/config/curves, - ../../constantine/math/elliptic/ec_shortweierstrass_projective, - ../../constantine/math/extension_fields, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_projective, + constantine/math/extension_fields, # Test utilities ./t_ec_template diff --git a/tests/math_elliptic_curves/t_ec_shortw_prj_g2_add_double_bn254_snarks.nim b/tests/math_elliptic_curves/t_ec_shortw_prj_g2_add_double_bn254_snarks.nim index e0954b2f..53949a66 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_prj_g2_add_double_bn254_snarks.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_prj_g2_add_double_bn254_snarks.nim @@ -8,9 +8,9 @@ import # Internals - ../../constantine/math/config/curves, - ../../constantine/math/elliptic/ec_shortweierstrass_projective, - ../../constantine/math/extension_fields, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_projective, + constantine/math/extension_fields, # Test utilities ./t_ec_template diff --git a/tests/math_elliptic_curves/t_ec_shortw_prj_g2_add_double_bw6_761.nim b/tests/math_elliptic_curves/t_ec_shortw_prj_g2_add_double_bw6_761.nim index 190b5696..5063664a 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_prj_g2_add_double_bw6_761.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_prj_g2_add_double_bw6_761.nim @@ -8,8 +8,8 @@ import # Internals - ../../constantine/math/config/[type_ff, curves], - ../../constantine/math/elliptic/ec_shortweierstrass_projective, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_projective, # Test utilities ./t_ec_template diff --git a/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mixed_add_bls12_377.nim b/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mixed_add_bls12_377.nim index 5e8e1d28..24156b13 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mixed_add_bls12_377.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mixed_add_bls12_377.nim @@ -8,9 +8,9 @@ import # Internals - ../../constantine/math/config/curves, - ../../constantine/math/elliptic/ec_shortweierstrass_projective, - ../../constantine/math/extension_fields, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_projective, + constantine/math/extension_fields, # Test utilities ./t_ec_template diff --git a/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mixed_add_bls12_381.nim b/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mixed_add_bls12_381.nim index 119115d9..b70c6c7b 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mixed_add_bls12_381.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mixed_add_bls12_381.nim @@ -8,9 +8,9 @@ import # Internals - ../../constantine/math/config/curves, - ../../constantine/math/elliptic/ec_shortweierstrass_projective, - ../../constantine/math/extension_fields, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_projective, + constantine/math/extension_fields, # Test utilities ./t_ec_template diff --git a/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mixed_add_bn254_snarks.nim b/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mixed_add_bn254_snarks.nim index d1350370..492be4d1 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mixed_add_bn254_snarks.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mixed_add_bn254_snarks.nim @@ -8,9 +8,9 @@ import # Internals - ../../constantine/math/config/curves, - ../../constantine/math/elliptic/ec_shortweierstrass_projective, - ../../constantine/math/extension_fields, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_projective, + constantine/math/extension_fields, # Test utilities ./t_ec_template diff --git a/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mixed_add_bw6_761.nim b/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mixed_add_bw6_761.nim index d8f6b9c1..1e78ea90 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mixed_add_bw6_761.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mixed_add_bw6_761.nim @@ -8,8 +8,8 @@ import # Internals - ../../constantine/math/config/[type_ff, curves], - ../../constantine/math/elliptic/ec_shortweierstrass_projective, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_projective, # Test utilities ./t_ec_template diff --git a/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_distri_bls12_377.nim b/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_distri_bls12_377.nim index b8d45a73..fd22116a 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_distri_bls12_377.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_distri_bls12_377.nim @@ -8,9 +8,9 @@ import # Internals - ../../constantine/math/config/curves, - ../../constantine/math/elliptic/ec_shortweierstrass_projective, - ../../constantine/math/extension_fields, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_projective, + constantine/math/extension_fields, # Test utilities ./t_ec_template diff --git a/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_distri_bls12_381.nim b/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_distri_bls12_381.nim index 9254fe54..3b8160b0 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_distri_bls12_381.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_distri_bls12_381.nim @@ -8,9 +8,9 @@ import # Internals - ../../constantine/math/config/curves, - ../../constantine/math/elliptic/ec_shortweierstrass_projective, - ../../constantine/math/extension_fields, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_projective, + constantine/math/extension_fields, # Test utilities ./t_ec_template diff --git a/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_distri_bn254_snarks.nim b/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_distri_bn254_snarks.nim index 89267896..0b1554b2 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_distri_bn254_snarks.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_distri_bn254_snarks.nim @@ -8,9 +8,9 @@ import # Internals - ../../constantine/math/config/curves, - ../../constantine/math/elliptic/ec_shortweierstrass_projective, - ../../constantine/math/extension_fields, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_projective, + constantine/math/extension_fields, # Test utilities ./t_ec_template diff --git a/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_distri_bw6_761.nim b/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_distri_bw6_761.nim index 336c65b2..bb631418 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_distri_bw6_761.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_distri_bw6_761.nim @@ -8,8 +8,8 @@ import # Internals - ../../constantine/math/config/[type_ff, curves], - ../../constantine/math/elliptic/ec_shortweierstrass_projective, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_projective, # Test utilities ./t_ec_template diff --git a/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_sanity_bls12_377.nim b/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_sanity_bls12_377.nim index d1aa0e49..5f0d0759 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_sanity_bls12_377.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_sanity_bls12_377.nim @@ -8,9 +8,9 @@ import # Internals - ../../constantine/math/config/curves, - ../../constantine/math/elliptic/ec_shortweierstrass_projective, - ../../constantine/math/extension_fields, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_projective, + constantine/math/extension_fields, # Test utilities ./t_ec_template diff --git a/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_sanity_bls12_381.nim b/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_sanity_bls12_381.nim index 7633fedd..fb2f7881 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_sanity_bls12_381.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_sanity_bls12_381.nim @@ -8,9 +8,9 @@ import # Internals - ../../constantine/math/config/curves, - ../../constantine/math/elliptic/ec_shortweierstrass_projective, - ../../constantine/math/extension_fields, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_projective, + constantine/math/extension_fields, # Test utilities ./t_ec_template diff --git a/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_sanity_bn254_snarks.nim b/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_sanity_bn254_snarks.nim index 2a956649..8fa24a9b 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_sanity_bn254_snarks.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_sanity_bn254_snarks.nim @@ -8,9 +8,9 @@ import # Internals - ../../constantine/math/config/curves, - ../../constantine/math/elliptic/ec_shortweierstrass_projective, - ../../constantine/math/extension_fields, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_projective, + constantine/math/extension_fields, # Test utilities ./t_ec_template diff --git a/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_sanity_bw6_761.nim b/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_sanity_bw6_761.nim index 50630e78..d61222b6 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_sanity_bw6_761.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_sanity_bw6_761.nim @@ -8,8 +8,8 @@ import # Internals - ../../constantine/math/config/[type_ff, curves], - ../../constantine/math/elliptic/ec_shortweierstrass_projective, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_projective, # Test utilities ./t_ec_template diff --git a/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_vs_ref_bls12_377.nim b/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_vs_ref_bls12_377.nim index 42eb1309..1c0c08e2 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_vs_ref_bls12_377.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_vs_ref_bls12_377.nim @@ -8,9 +8,9 @@ import # Internals - ../../constantine/math/config/curves, - ../../constantine/math/elliptic/ec_shortweierstrass_projective, - ../../constantine/math/extension_fields, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_projective, + constantine/math/extension_fields, # Test utilities ./t_ec_template diff --git a/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_vs_ref_bls12_381.nim b/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_vs_ref_bls12_381.nim index 200a939a..bbca0790 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_vs_ref_bls12_381.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_vs_ref_bls12_381.nim @@ -8,9 +8,9 @@ import # Internals - ../../constantine/math/config/curves, - ../../constantine/math/elliptic/ec_shortweierstrass_projective, - ../../constantine/math/extension_fields, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_projective, + constantine/math/extension_fields, # Test utilities ./t_ec_template diff --git a/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_vs_ref_bn254_snarks.nim b/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_vs_ref_bn254_snarks.nim index bfc4221f..94c486cc 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_vs_ref_bn254_snarks.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_vs_ref_bn254_snarks.nim @@ -8,9 +8,9 @@ import # Internals - ../../constantine/math/config/curves, - ../../constantine/math/elliptic/ec_shortweierstrass_projective, - ../../constantine/math/extension_fields, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_projective, + constantine/math/extension_fields, # Test utilities ./t_ec_template diff --git a/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_vs_ref_bw6_761.nim b/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_vs_ref_bw6_761.nim index c48f683c..6a10fb69 100644 --- a/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_vs_ref_bw6_761.nim +++ b/tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_vs_ref_bw6_761.nim @@ -8,8 +8,8 @@ import # Internals - ../../constantine/math/config/[type_ff, curves], - ../../constantine/math/elliptic/ec_shortweierstrass_projective, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_projective, # Test utilities ./t_ec_template diff --git a/tests/math_elliptic_curves/t_ec_subgroups_bls12_377.nim b/tests/math_elliptic_curves/t_ec_subgroups_bls12_377.nim index 72d9ca7e..17d09558 100644 --- a/tests/math_elliptic_curves/t_ec_subgroups_bls12_377.nim +++ b/tests/math_elliptic_curves/t_ec_subgroups_bls12_377.nim @@ -8,9 +8,9 @@ import # Internals - ../../constantine/math/config/curves, - ../../constantine/math/elliptic/ec_shortweierstrass_projective, - ../../constantine/math/extension_fields, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_projective, + constantine/math/extension_fields, # Test utilities ./t_ec_template @@ -28,4 +28,4 @@ run_EC_subgroups_cofactors_impl( ec = ECP_ShortW_Prj[Fp2[BLS12_377], G2], ItersMul = ItersMul, moduleName = "test_ec_subgroups_g2_" & $BLS12_377 - ) \ No newline at end of file + ) diff --git a/tests/math_elliptic_curves/t_ec_subgroups_bls12_381.nim b/tests/math_elliptic_curves/t_ec_subgroups_bls12_381.nim index 34c51b98..62724e1f 100644 --- a/tests/math_elliptic_curves/t_ec_subgroups_bls12_381.nim +++ b/tests/math_elliptic_curves/t_ec_subgroups_bls12_381.nim @@ -8,9 +8,9 @@ import # Internals - ../../constantine/math/config/curves, - ../../constantine/math/elliptic/ec_shortweierstrass_projective, - ../../constantine/math/extension_fields, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_projective, + constantine/math/extension_fields, # Test utilities ./t_ec_template @@ -28,4 +28,4 @@ run_EC_subgroups_cofactors_impl( ec = ECP_ShortW_Prj[Fp2[BLS12_381], G2], ItersMul = ItersMul, moduleName = "test_ec_subgroups_g2_" & $BLS12_381 - ) \ No newline at end of file + ) diff --git a/tests/math_elliptic_curves/t_ec_subgroups_bn254_nogami.nim b/tests/math_elliptic_curves/t_ec_subgroups_bn254_nogami.nim index ac4291f6..837d367f 100644 --- a/tests/math_elliptic_curves/t_ec_subgroups_bn254_nogami.nim +++ b/tests/math_elliptic_curves/t_ec_subgroups_bn254_nogami.nim @@ -8,9 +8,9 @@ import # Internals - ../../constantine/math/config/curves, - ../../constantine/math/elliptic/ec_shortweierstrass_projective, - ../../constantine/math/extension_fields, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_projective, + constantine/math/extension_fields, # Test utilities ./t_ec_template @@ -28,4 +28,4 @@ run_EC_subgroups_cofactors_impl( ec = ECP_ShortW_Prj[Fp2[BN254_Nogami], G2], ItersMul = ItersMul, moduleName = "test_ec_subgroups_g2_" & $BN254_Nogami - ) \ No newline at end of file + ) diff --git a/tests/math_elliptic_curves/t_ec_subgroups_bn254_snarks.nim b/tests/math_elliptic_curves/t_ec_subgroups_bn254_snarks.nim index aa3c33ba..2e9aaa1b 100644 --- a/tests/math_elliptic_curves/t_ec_subgroups_bn254_snarks.nim +++ b/tests/math_elliptic_curves/t_ec_subgroups_bn254_snarks.nim @@ -8,9 +8,9 @@ import # Internals - ../../constantine/math/config/curves, - ../../constantine/math/elliptic/ec_shortweierstrass_projective, - ../../constantine/math/extension_fields, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_projective, + constantine/math/extension_fields, # Test utilities ./t_ec_template @@ -28,4 +28,4 @@ run_EC_subgroups_cofactors_impl( ec = ECP_ShortW_Prj[Fp2[BN254_Snarks], G2], ItersMul = ItersMul, moduleName = "test_ec_subgroups_g2_" & $BN254_Snarks - ) \ No newline at end of file + ) diff --git a/tests/math_elliptic_curves/t_ec_template.nim b/tests/math_elliptic_curves/t_ec_template.nim index a56a3118..2caf6f33 100644 --- a/tests/math_elliptic_curves/t_ec_template.nim +++ b/tests/math_elliptic_curves/t_ec_template.nim @@ -16,10 +16,10 @@ import # Standard library std/[unittest, times], # Internals - ../../constantine/platforms/abstractions, - ../../constantine/math/config/curves, - ../../constantine/math/[arithmetic, extension_fields], - ../../constantine/math/elliptic/[ + constantine/platforms/abstractions, + constantine/named/algebra, + constantine/math/[arithmetic, extension_fields], + constantine/math/elliptic/[ ec_shortweierstrass_affine, ec_shortweierstrass_jacobian, ec_shortweierstrass_jacobian_extended, @@ -29,11 +29,11 @@ import ec_twistededwards_projective, ec_scalar_mul, ec_multi_scalar_mul], - ../../constantine/math/io/[io_bigints, io_fields, io_ec], - ../../constantine/math/constants/zoo_subgroups, + constantine/math/io/[io_bigints, io_fields, io_ec], + constantine/named/zoo_subgroups, # Test utilities - ../../helpers/prng_unsafe, - ../../constantine/math/elliptic/ec_scalar_mul_vartime + helpers/prng_unsafe, + constantine/math/elliptic/ec_scalar_mul_vartime export unittest, abstractions, arithmetic # Generic sandwich diff --git a/tests/math_elliptic_curves/t_ec_twedwards_prj_add_double.nim b/tests/math_elliptic_curves/t_ec_twedwards_prj_add_double.nim index 42d3a89b..dee4c635 100644 --- a/tests/math_elliptic_curves/t_ec_twedwards_prj_add_double.nim +++ b/tests/math_elliptic_curves/t_ec_twedwards_prj_add_double.nim @@ -8,8 +8,8 @@ import # Internals - ../../constantine/math/config/[type_ff, curves], - ../../constantine/math/elliptic/ec_twistededwards_projective, + constantine/named/algebra, + constantine/math/elliptic/ec_twistededwards_projective, # Test utilities ./t_ec_template @@ -38,4 +38,4 @@ run_EC_addition_tests( ec = ECP_TwEdwards_Prj[Fp[Banderwagon]], Iters = Iters, moduleName = "test_ec_twistededwards_projective_add_double_" & $Banderwagon - ) \ No newline at end of file + ) diff --git a/tests/math_elliptic_curves/t_ec_twedwards_prj_msm.nim b/tests/math_elliptic_curves/t_ec_twedwards_prj_msm.nim index 2f0c770e..605eedf0 100644 --- a/tests/math_elliptic_curves/t_ec_twedwards_prj_msm.nim +++ b/tests/math_elliptic_curves/t_ec_twedwards_prj_msm.nim @@ -8,9 +8,9 @@ import # Internals - ../../constantine/math/config/curves, - ../../constantine/math/elliptic/ec_twistededwards_projective, - ../../constantine/math/arithmetic, + constantine/named/algebra, + constantine/math/elliptic/ec_twistededwards_projective, + constantine/math/arithmetic, # Test utilities ./t_ec_template diff --git a/tests/math_elliptic_curves/t_ec_twedwards_prj_mul_distri.nim b/tests/math_elliptic_curves/t_ec_twedwards_prj_mul_distri.nim index 173994e4..5a11cdc6 100644 --- a/tests/math_elliptic_curves/t_ec_twedwards_prj_mul_distri.nim +++ b/tests/math_elliptic_curves/t_ec_twedwards_prj_mul_distri.nim @@ -8,8 +8,8 @@ import # Internals - ../../constantine/math/config/[type_ff, curves], - ../../constantine/math/elliptic/ec_twistededwards_projective, + constantine/named/algebra, + constantine/math/elliptic/ec_twistededwards_projective, # Test utilities ./t_ec_template @@ -39,4 +39,4 @@ run_EC_mul_distributive_tests( ec = ECP_TwEdwards_Prj[Fp[Banderwagon]], ItersMul = ItersMul, moduleName = "test_ec_twistededwards_projective_mul_distributive_" & $Banderwagon - ) \ No newline at end of file + ) diff --git a/tests/math_elliptic_curves/t_ec_twedwards_prj_mul_sanity.nim b/tests/math_elliptic_curves/t_ec_twedwards_prj_mul_sanity.nim index be52778b..656a3642 100644 --- a/tests/math_elliptic_curves/t_ec_twedwards_prj_mul_sanity.nim +++ b/tests/math_elliptic_curves/t_ec_twedwards_prj_mul_sanity.nim @@ -8,11 +8,11 @@ import # Internals - ../../constantine/math/config/[type_ff, curves], - ../../constantine/math/elliptic/ec_twistededwards_projective, + constantine/named/algebra, + constantine/math/elliptic/ec_twistededwards_projective, # Test utilities ./t_ec_template - + const Iters = 12 ItersMul = Iters div 4 @@ -33,4 +33,4 @@ run_EC_mul_sanity_tests( ec = ECP_TwEdwards_Prj[Fp[Bandersnatch]], ItersMul = ItersMul, moduleName = "test_ec_twistededwards_projective_mul_sanity_" & $Bandersnatch - ) \ No newline at end of file + ) diff --git a/tests/math_elliptic_curves/t_ec_twedwards_prj_mul_vs_ref.nim b/tests/math_elliptic_curves/t_ec_twedwards_prj_mul_vs_ref.nim index b8c50c4a..9f7c954f 100644 --- a/tests/math_elliptic_curves/t_ec_twedwards_prj_mul_vs_ref.nim +++ b/tests/math_elliptic_curves/t_ec_twedwards_prj_mul_vs_ref.nim @@ -8,8 +8,8 @@ import # Internals - ../../constantine/math/config/[type_ff, curves], - ../../constantine/math/elliptic/ec_twistededwards_projective, + constantine/named/algebra, + constantine/math/elliptic/ec_twistededwards_projective, # Test utilities ./t_ec_template diff --git a/tests/math_extension_fields/t_fp12_anti_regression.nim b/tests/math_extension_fields/t_fp12_anti_regression.nim index 43cf7222..aaae68e6 100644 --- a/tests/math_extension_fields/t_fp12_anti_regression.nim +++ b/tests/math_extension_fields/t_fp12_anti_regression.nim @@ -10,11 +10,11 @@ import # stdlib std/unittest, # Internals - ../../constantine/platforms/abstractions, - ../../constantine/math/extension_fields, - ../../constantine/math/config/curves, - ../../constantine/math/io/io_extfields, - ../../constantine/math/extension_fields + constantine/platforms/abstractions, + constantine/math/extension_fields, + constantine/named/algebra, + constantine/math/io/io_extfields, + constantine/math/extension_fields # ############################################################### # diff --git a/tests/math_extension_fields/t_fp12_bls12_377.nim b/tests/math_extension_fields/t_fp12_bls12_377.nim index 31cca844..1c0bd4ff 100644 --- a/tests/math_extension_fields/t_fp12_bls12_377.nim +++ b/tests/math_extension_fields/t_fp12_bls12_377.nim @@ -8,8 +8,8 @@ import # Internals - ../../constantine/math/extension_fields, - ../../constantine/math/config/curves, + constantine/math/extension_fields, + constantine/named/algebra, # Test utilities ./t_fp_tower_template diff --git a/tests/math_extension_fields/t_fp12_bls12_381.nim b/tests/math_extension_fields/t_fp12_bls12_381.nim index d015b566..4083995c 100644 --- a/tests/math_extension_fields/t_fp12_bls12_381.nim +++ b/tests/math_extension_fields/t_fp12_bls12_381.nim @@ -8,8 +8,8 @@ import # Internals - ../../constantine/math/extension_fields, - ../../constantine/math/config/curves, + constantine/math/extension_fields, + constantine/named/algebra, # Test utilities ./t_fp_tower_template diff --git a/tests/math_extension_fields/t_fp12_bn254_nogami.nim b/tests/math_extension_fields/t_fp12_bn254_nogami.nim index 89a7fe6f..1876efc2 100644 --- a/tests/math_extension_fields/t_fp12_bn254_nogami.nim +++ b/tests/math_extension_fields/t_fp12_bn254_nogami.nim @@ -8,8 +8,8 @@ import # Internals - ../../constantine/math/extension_fields, - ../../constantine/math/config/curves, + constantine/math/extension_fields, + constantine/named/algebra, # Test utilities ./t_fp_tower_template diff --git a/tests/math_extension_fields/t_fp12_bn254_snarks.nim b/tests/math_extension_fields/t_fp12_bn254_snarks.nim index 9ee54ffd..ad05b0e2 100644 --- a/tests/math_extension_fields/t_fp12_bn254_snarks.nim +++ b/tests/math_extension_fields/t_fp12_bn254_snarks.nim @@ -8,8 +8,8 @@ import # Internals - ../../constantine/math/extension_fields, - ../../constantine/math/config/curves, + constantine/math/extension_fields, + constantine/named/algebra, # Test utilities ./t_fp_tower_template diff --git a/tests/math_extension_fields/t_fp12_exponentiation.nim b/tests/math_extension_fields/t_fp12_exponentiation.nim index b539f296..a8c77c94 100644 --- a/tests/math_extension_fields/t_fp12_exponentiation.nim +++ b/tests/math_extension_fields/t_fp12_exponentiation.nim @@ -10,13 +10,13 @@ import # Standard library std/[tables, unittest, times], # Internals - ../../constantine/platforms/abstractions, - ../../constantine/math/arithmetic, - ../../constantine/math/extension_fields, - ../../constantine/math/config/curves, - ../../constantine/math/io/io_extfields, + constantine/platforms/abstractions, + constantine/math/arithmetic, + constantine/math/extension_fields, + constantine/named/algebra, + constantine/math/io/io_extfields, # Test utilities - ../../helpers/prng_unsafe + helpers/prng_unsafe const Iters = 2 diff --git a/tests/math_extension_fields/t_fp12_frobenius.nim b/tests/math_extension_fields/t_fp12_frobenius.nim index 3e994e33..bc16752b 100644 --- a/tests/math_extension_fields/t_fp12_frobenius.nim +++ b/tests/math_extension_fields/t_fp12_frobenius.nim @@ -8,8 +8,8 @@ import # Internals - ../../constantine/math/extension_fields, - ../../constantine/math/config/curves, + constantine/math/extension_fields, + constantine/named/algebra, # Test utilities ./t_fp_tower_frobenius_template diff --git a/tests/math_extension_fields/t_fp2.nim b/tests/math_extension_fields/t_fp2.nim index 3fe42d6a..8aee6b67 100644 --- a/tests/math_extension_fields/t_fp2.nim +++ b/tests/math_extension_fields/t_fp2.nim @@ -8,7 +8,7 @@ import # Internals - ../../constantine/math/config/curves, + constantine/named/algebra, # Test utilities ./t_fp_tower_template diff --git a/tests/math_extension_fields/t_fp2_frobenius.nim b/tests/math_extension_fields/t_fp2_frobenius.nim index f7383c30..f30705ce 100644 --- a/tests/math_extension_fields/t_fp2_frobenius.nim +++ b/tests/math_extension_fields/t_fp2_frobenius.nim @@ -8,8 +8,8 @@ import # Internals - ../../constantine/math/extension_fields, - ../../constantine/math/config/curves, + constantine/math/extension_fields, + constantine/named/algebra, # Test utilities ./t_fp_tower_frobenius_template diff --git a/tests/math_extension_fields/t_fp2_sqrt.nim b/tests/math_extension_fields/t_fp2_sqrt.nim index 41cc13be..ff4f17bc 100644 --- a/tests/math_extension_fields/t_fp2_sqrt.nim +++ b/tests/math_extension_fields/t_fp2_sqrt.nim @@ -10,13 +10,13 @@ import # Standard library std/[tables, unittest, times], # Internals - ../../constantine/platforms/abstractions, - ../../constantine/math/arithmetic, - ../../constantine/math/extension_fields, - ../../constantine/math/config/curves, - ../../constantine/math/io/io_extfields, + constantine/platforms/abstractions, + constantine/math/arithmetic, + constantine/math/extension_fields, + constantine/named/algebra, + constantine/math/io/io_extfields, # Test utilities - ../../helpers/prng_unsafe + helpers/prng_unsafe const Iters = 8 diff --git a/tests/math_extension_fields/t_fp4.nim b/tests/math_extension_fields/t_fp4.nim index ecfed510..fae11bad 100644 --- a/tests/math_extension_fields/t_fp4.nim +++ b/tests/math_extension_fields/t_fp4.nim @@ -8,8 +8,8 @@ import # Internals - ../../constantine/math/io/io_extfields, - ../../constantine/math/config/curves, + constantine/math/io/io_extfields, + constantine/named/algebra, # Test utilities ./t_fp_tower_template diff --git a/tests/math_extension_fields/t_fp4_frobenius.nim b/tests/math_extension_fields/t_fp4_frobenius.nim index b1d6f74a..5238393b 100644 --- a/tests/math_extension_fields/t_fp4_frobenius.nim +++ b/tests/math_extension_fields/t_fp4_frobenius.nim @@ -8,8 +8,8 @@ import # Internals - ../../constantine/math/extension_fields, - ../../constantine/math/config/curves, + constantine/math/extension_fields, + constantine/named/algebra, # Test utilities ./t_fp_tower_frobenius_template diff --git a/tests/math_extension_fields/t_fp6_bls12_377.nim b/tests/math_extension_fields/t_fp6_bls12_377.nim index ae58683c..facf74f2 100644 --- a/tests/math_extension_fields/t_fp6_bls12_377.nim +++ b/tests/math_extension_fields/t_fp6_bls12_377.nim @@ -8,8 +8,8 @@ import # Internals - ../../constantine/math/extension_fields, - ../../constantine/math/config/curves, + constantine/math/extension_fields, + constantine/named/algebra, # Test utilities ./t_fp_tower_template diff --git a/tests/math_extension_fields/t_fp6_bls12_381.nim b/tests/math_extension_fields/t_fp6_bls12_381.nim index d1e82fed..6be85137 100644 --- a/tests/math_extension_fields/t_fp6_bls12_381.nim +++ b/tests/math_extension_fields/t_fp6_bls12_381.nim @@ -8,8 +8,8 @@ import # Internals - ../../constantine/math/extension_fields, - ../../constantine/math/config/curves, + constantine/math/extension_fields, + constantine/named/algebra, # Test utilities ./t_fp_tower_template diff --git a/tests/math_extension_fields/t_fp6_bn254_nogami.nim b/tests/math_extension_fields/t_fp6_bn254_nogami.nim index 11fc55ca..d9bf4afa 100644 --- a/tests/math_extension_fields/t_fp6_bn254_nogami.nim +++ b/tests/math_extension_fields/t_fp6_bn254_nogami.nim @@ -8,8 +8,8 @@ import # Internals - ../../constantine/math/extension_fields, - ../../constantine/math/config/curves, + constantine/math/extension_fields, + constantine/named/algebra, # Test utilities ./t_fp_tower_template diff --git a/tests/math_extension_fields/t_fp6_bn254_snarks.nim b/tests/math_extension_fields/t_fp6_bn254_snarks.nim index 1344509a..54c7cdcf 100644 --- a/tests/math_extension_fields/t_fp6_bn254_snarks.nim +++ b/tests/math_extension_fields/t_fp6_bn254_snarks.nim @@ -8,8 +8,8 @@ import # Internals - ../../constantine/math/extension_fields, - ../../constantine/math/config/curves, + constantine/math/extension_fields, + constantine/named/algebra, # Test utilities ./t_fp_tower_template diff --git a/tests/math_extension_fields/t_fp6_bw6_761.nim b/tests/math_extension_fields/t_fp6_bw6_761.nim index c540ab6e..621d18c9 100644 --- a/tests/math_extension_fields/t_fp6_bw6_761.nim +++ b/tests/math_extension_fields/t_fp6_bw6_761.nim @@ -8,8 +8,8 @@ import # Internals - ../../constantine/math/extension_fields, - ../../constantine/math/config/curves, + constantine/math/extension_fields, + constantine/named/algebra, # Test utilities ./t_fp_tower_template diff --git a/tests/math_extension_fields/t_fp6_frobenius.nim b/tests/math_extension_fields/t_fp6_frobenius.nim index 21f09f24..8fe431ab 100644 --- a/tests/math_extension_fields/t_fp6_frobenius.nim +++ b/tests/math_extension_fields/t_fp6_frobenius.nim @@ -8,8 +8,8 @@ import # Internals - ../../constantine/math/extension_fields, - ../../constantine/math/config/curves, + constantine/math/extension_fields, + constantine/named/algebra, # Test utilities ./t_fp_tower_frobenius_template diff --git a/tests/math_extension_fields/t_fp_tower_frobenius_template.nim b/tests/math_extension_fields/t_fp_tower_frobenius_template.nim index b22e403d..899ad46f 100644 --- a/tests/math_extension_fields/t_fp_tower_frobenius_template.nim +++ b/tests/math_extension_fields/t_fp_tower_frobenius_template.nim @@ -17,13 +17,13 @@ import # Standard library std/[unittest, times], # Internals - ../../constantine/platforms/abstractions, - ../../constantine/math/extension_fields, - ../../constantine/math/config/curves, - ../../constantine/math/arithmetic, - ../../constantine/math/isogenies/frobenius, + constantine/platforms/abstractions, + constantine/math/extension_fields, + constantine/named/algebra, + constantine/math/arithmetic, + constantine/math/isogenies/frobenius, # Test utilities - ../../helpers/prng_unsafe + helpers/prng_unsafe export unittest # Generic sandwich diff --git a/tests/math_extension_fields/t_fp_tower_template.nim b/tests/math_extension_fields/t_fp_tower_template.nim index 50c2ed5c..ae7a6953 100644 --- a/tests/math_extension_fields/t_fp_tower_template.nim +++ b/tests/math_extension_fields/t_fp_tower_template.nim @@ -17,13 +17,13 @@ import # Standard library std/[unittest, times], # Internals - ../../constantine/platforms/abstractions, - ../../constantine/math/extension_fields, - ../../constantine/math/config/curves, - ../../constantine/math/arithmetic, - ../../constantine/math/io/io_extfields, + constantine/platforms/abstractions, + constantine/math/extension_fields, + constantine/named/algebra, + constantine/math/arithmetic, + constantine/math/io/io_extfields, # Test utilities - ../../helpers/prng_unsafe + helpers/prng_unsafe export unittest # Generic sandwich diff --git a/tests/math_fields/t_finite_fields.nim b/tests/math_fields/t_finite_fields.nim index 9890400d..fd387920 100644 --- a/tests/math_fields/t_finite_fields.nim +++ b/tests/math_fields/t_finite_fields.nim @@ -7,10 +7,10 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import std/unittest, - ../../constantine/math/arithmetic, - ../../constantine/math/arithmetic/limbs_montgomery, - ../../constantine/math/io/[io_bigints, io_fields], - ../../constantine/math/config/curves + constantine/math/arithmetic, + constantine/math/arithmetic/limbs_montgomery, + constantine/math/io/[io_bigints, io_fields], + constantine/named/algebra static: doAssert defined(CTT_TEST_CURVES), "This modules requires the -d:CTT_TEST_CURVES compile option" diff --git a/tests/math_fields/t_finite_fields_conditional_arithmetic.nim b/tests/math_fields/t_finite_fields_conditional_arithmetic.nim index 9f4b5533..cd7e2f82 100644 --- a/tests/math_fields/t_finite_fields_conditional_arithmetic.nim +++ b/tests/math_fields/t_finite_fields_conditional_arithmetic.nim @@ -7,10 +7,10 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import std/unittest, - ../../constantine/platforms/abstractions, - ../../constantine/math/arithmetic, - ../../constantine/math/io/io_fields, - ../../constantine/math/config/curves + constantine/platforms/abstractions, + constantine/math/arithmetic, + constantine/math/io/io_fields, + constantine/named/algebra echo "\n------------------------------------------------------\n" diff --git a/tests/math_fields/t_finite_fields_double_precision.nim b/tests/math_fields/t_finite_fields_double_precision.nim index 5fb6a6a5..678717ad 100644 --- a/tests/math_fields/t_finite_fields_double_precision.nim +++ b/tests/math_fields/t_finite_fields_double_precision.nim @@ -10,12 +10,12 @@ import # Standard library std/[unittest, times], # Internal - ../../constantine/platforms/abstractions, - ../../constantine/math/arithmetic, - ../../constantine/math/io/[io_bigints, io_fields], - ../../constantine/math/config/[curves, type_bigint], + constantine/platforms/abstractions, + constantine/math/arithmetic, + constantine/math/io/[io_bigints, io_fields], + constantine/named/algebra, # Test utilities - ../../helpers/prng_unsafe + helpers/prng_unsafe const Iters = 12 @@ -325,4 +325,4 @@ suite "Field Squaring via double-precision field elements is consistent with sin for _ in 0 ..< Iters: sqr_randomHighHammingWeight(Vesta) for _ in 0 ..< Iters: - sqr_random_long01Seq(Vesta) \ No newline at end of file + sqr_random_long01Seq(Vesta) diff --git a/tests/math_fields/t_finite_fields_mulsquare.nim b/tests/math_fields/t_finite_fields_mulsquare.nim index 2c8f1ef9..d1131cb1 100644 --- a/tests/math_fields/t_finite_fields_mulsquare.nim +++ b/tests/math_fields/t_finite_fields_mulsquare.nim @@ -10,12 +10,12 @@ import # Standard library std/[unittest, times], # Internal - ../../constantine/platforms/abstractions, - ../../constantine/math/arithmetic, - ../../constantine/math/io/[io_bigints, io_fields], - ../../constantine/math/config/[curves, type_bigint], + constantine/platforms/abstractions, + constantine/math/arithmetic, + constantine/math/io/[io_bigints, io_fields], + constantine/math/config/[curves, type_bigint], # Test utilities - ../../helpers/prng_unsafe + helpers/prng_unsafe const Iters = 12 @@ -388,4 +388,4 @@ suite "Random sum products is consistent with naive " & " [" & $WordBitWidth & " test "Random sum products mod BLS12_381]": for _ in 0 ..< Iters: staticFor N, 2, MaxLength: - random_sumprod(BLS12_381, N) \ No newline at end of file + random_sumprod(BLS12_381, N) diff --git a/tests/math_fields/t_finite_fields_powinv.nim b/tests/math_fields/t_finite_fields_powinv.nim index 35719425..85acd4d0 100644 --- a/tests/math_fields/t_finite_fields_powinv.nim +++ b/tests/math_fields/t_finite_fields_powinv.nim @@ -10,12 +10,12 @@ import # Standard library std/[unittest, times, strutils], # Internal - ../../constantine/platforms/abstractions, - ../../constantine/math/arithmetic, - ../../constantine/math/io/[io_bigints, io_fields], - ../../constantine/math/config/curves, + constantine/platforms/abstractions, + constantine/math/arithmetic, + constantine/math/io/[io_bigints, io_fields], + constantine/named/algebra, # Test utilities - ../../helpers/prng_unsafe + helpers/prng_unsafe static: doAssert defined(CTT_TEST_CURVES), "This modules requires the -d:CTT_TEST_CURVES compile option" diff --git a/tests/math_fields/t_finite_fields_sqrt.nim b/tests/math_fields/t_finite_fields_sqrt.nim index 4b828fbd..d011dfb1 100644 --- a/tests/math_fields/t_finite_fields_sqrt.nim +++ b/tests/math_fields/t_finite_fields_sqrt.nim @@ -10,12 +10,12 @@ import # Standard library std/[tables, unittest, times], # Internal - ../../constantine/platforms/abstractions, - ../../constantine/math/arithmetic, - ../../constantine/math/io/io_fields, - ../../constantine/math/config/curves, + constantine/platforms/abstractions, + constantine/math/arithmetic, + constantine/math/io/io_fields, + constantine/named/algebra, # Test utilities - ../../helpers/prng_unsafe + helpers/prng_unsafe const Iters = 8 diff --git a/tests/math_fields/t_finite_fields_vs_gmp.nim b/tests/math_fields/t_finite_fields_vs_gmp.nim index 3d42e2be..935b136d 100644 --- a/tests/math_fields/t_finite_fields_vs_gmp.nim +++ b/tests/math_fields/t_finite_fields_vs_gmp.nim @@ -12,13 +12,13 @@ import # Third-party gmp, # Internal - ../../constantine/platforms/abstractions, - ../../constantine/serialization/codecs, - ../../constantine/math/io/[io_bigints, io_fields], - ../../constantine/math/arithmetic, - ../../constantine/math/config/curves, + constantine/platforms/abstractions, + constantine/serialization/codecs, + constantine/math/io/[io_bigints, io_fields], + constantine/math/arithmetic, + constantine/named/algebra, # Test utilities - ../../helpers/prng_unsafe + helpers/prng_unsafe echo "\n------------------------------------------------------\n" diff --git a/tests/math_fields/t_fp_cubic_root.nim b/tests/math_fields/t_fp_cubic_root.nim index 90754254..61d7a581 100644 --- a/tests/math_fields/t_fp_cubic_root.nim +++ b/tests/math_fields/t_fp_cubic_root.nim @@ -7,10 +7,10 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import std/unittest, - ../../constantine/platforms/abstractions, - ../../constantine/math/arithmetic, - ../../constantine/math/config/curves, - ../../constantine/math/constants/zoo_endomorphisms + constantine/platforms/abstractions, + constantine/math/arithmetic, + constantine/named/algebra, + constantine/named/zoo_endomorphisms echo "\n------------------------------------------------------\n" diff --git a/tests/math_fields/t_fr.nim b/tests/math_fields/t_fr.nim index dfaa62bb..1ad1bde0 100644 --- a/tests/math_fields/t_fr.nim +++ b/tests/math_fields/t_fr.nim @@ -10,12 +10,12 @@ import # Standard library std/[unittest, times], # Internal - ../../constantine/platforms/abstractions, - ../../constantine/math/arithmetic, - ../../constantine/math/io/[io_bigints, io_fields], - ../../constantine/math/config/curves, + constantine/platforms/abstractions, + constantine/math/arithmetic, + constantine/math/io/[io_bigints, io_fields], + constantine/named/algebra, # Test utilities - ../../helpers/prng_unsafe + helpers/prng_unsafe const Iters = 24 diff --git a/tests/math_fields/t_io_fields.nim b/tests/math_fields/t_io_fields.nim index 5b47c1f2..2644eebb 100644 --- a/tests/math_fields/t_io_fields.nim +++ b/tests/math_fields/t_io_fields.nim @@ -7,11 +7,11 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import std/[unittest, times], - ../../constantine/math/io/[io_bigints, io_fields], - ../../constantine/math/config/curves, - ../../constantine/platforms/abstractions, - ../../constantine/math/arithmetic, - ../../helpers/prng_unsafe + constantine/math/io/[io_bigints, io_fields], + constantine/named/algebra, + constantine/platforms/abstractions, + constantine/math/arithmetic, + helpers/prng_unsafe # Random seed for reproducibility var rng: RngState diff --git a/tests/math_pairings/t_pairing_bls12_377_gt_subgroup.nim b/tests/math_pairings/t_pairing_bls12_377_gt_subgroup.nim index bf3e8f6d..e627f245 100644 --- a/tests/math_pairings/t_pairing_bls12_377_gt_subgroup.nim +++ b/tests/math_pairings/t_pairing_bls12_377_gt_subgroup.nim @@ -7,7 +7,7 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../../constantine/math/pairings/pairings_bls12, + constantine/math/pairings/pairings_bls12, # Test utilities ./t_pairing_template diff --git a/tests/math_pairings/t_pairing_bls12_377_line_functions.nim b/tests/math_pairings/t_pairing_bls12_377_line_functions.nim index 2b0dbb5a..befe570c 100644 --- a/tests/math_pairings/t_pairing_bls12_377_line_functions.nim +++ b/tests/math_pairings/t_pairing_bls12_377_line_functions.nim @@ -10,18 +10,18 @@ import # Standard library std/[unittest, times], # Internals - ../../constantine/platforms/abstractions, - ../../constantine/math/arithmetic, - ../../constantine/math/extension_fields, - ../../constantine/math/config/curves, - ../../constantine/math/io/io_extfields, - ../../constantine/math/elliptic/[ + constantine/platforms/abstractions, + constantine/math/arithmetic, + constantine/math/extension_fields, + constantine/named/algebra, + constantine/math/io/io_extfields, + constantine/math/elliptic/[ ec_shortweierstrass_affine, ec_shortweierstrass_projective, ec_scalar_mul], - ../../constantine/math/pairings/lines_eval, + constantine/math/pairings/lines_eval, # Test utilities - ../../helpers/prng_unsafe + helpers/prng_unsafe const Iters = 4 diff --git a/tests/math_pairings/t_pairing_bls12_377_multi.nim b/tests/math_pairings/t_pairing_bls12_377_multi.nim index f4c438e1..296cb9a2 100644 --- a/tests/math_pairings/t_pairing_bls12_377_multi.nim +++ b/tests/math_pairings/t_pairing_bls12_377_multi.nim @@ -10,13 +10,13 @@ import # Standard library std/[os, times, strformat], # Internals - ../../constantine/platforms/abstractions, - ../../constantine/math/[arithmetic, extension_fields, ec_shortweierstrass], - ../../constantine/math/io/io_extfields, - ../../constantine/math/config/curves, - ../../constantine/math/pairings/pairings_bls12, + constantine/platforms/abstractions, + constantine/math/[arithmetic, extension_fields, ec_shortweierstrass], + constantine/math/io/io_extfields, + constantine/named/algebra, + constantine/math/pairings/pairings_bls12, # Test utilities - ../../helpers/prng_unsafe + helpers/prng_unsafe # Testing multipairing # ---------------------------------------------- diff --git a/tests/math_pairings/t_pairing_bls12_377_optate.nim b/tests/math_pairings/t_pairing_bls12_377_optate.nim index 6bffe1b6..5a8a3ac4 100644 --- a/tests/math_pairings/t_pairing_bls12_377_optate.nim +++ b/tests/math_pairings/t_pairing_bls12_377_optate.nim @@ -7,7 +7,7 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../../constantine/math/pairings/pairings_bls12, + constantine/math/pairings/pairings_bls12, # Test utilities ./t_pairing_template diff --git a/tests/math_pairings/t_pairing_bls12_381_gt_subgroup.nim b/tests/math_pairings/t_pairing_bls12_381_gt_subgroup.nim index 0095d852..371ef622 100644 --- a/tests/math_pairings/t_pairing_bls12_381_gt_subgroup.nim +++ b/tests/math_pairings/t_pairing_bls12_381_gt_subgroup.nim @@ -7,7 +7,7 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../../constantine/math/pairings/pairings_bls12, + constantine/math/pairings/pairings_bls12, # Test utilities ./t_pairing_template diff --git a/tests/math_pairings/t_pairing_bls12_381_line_functions.nim b/tests/math_pairings/t_pairing_bls12_381_line_functions.nim index df9e9862..6d8cba8a 100644 --- a/tests/math_pairings/t_pairing_bls12_381_line_functions.nim +++ b/tests/math_pairings/t_pairing_bls12_381_line_functions.nim @@ -10,17 +10,17 @@ import # Standard library std/[unittest, times], # Internals - ../../constantine/platforms/abstractions, - ../../constantine/math/arithmetic, - ../../constantine/math/extension_fields, - ../../constantine/math/config/curves, - ../../constantine/math/io/io_extfields, - ../../constantine/math/elliptic/[ + constantine/platforms/abstractions, + constantine/math/arithmetic, + constantine/math/extension_fields, + constantine/named/algebra, + constantine/math/io/io_extfields, + constantine/math/elliptic/[ ec_shortweierstrass_affine, ec_shortweierstrass_projective], - ../../constantine/math/pairings/lines_eval, + constantine/math/pairings/lines_eval, # Test utilities - ../../helpers/prng_unsafe + helpers/prng_unsafe const Iters = 4 diff --git a/tests/math_pairings/t_pairing_bls12_381_multi.nim b/tests/math_pairings/t_pairing_bls12_381_multi.nim index d365f13d..1fa3a168 100644 --- a/tests/math_pairings/t_pairing_bls12_381_multi.nim +++ b/tests/math_pairings/t_pairing_bls12_381_multi.nim @@ -10,13 +10,13 @@ import # Standard library std/[os, times, strformat], # Internals - ../../constantine/platforms/abstractions, - ../../constantine/math/[arithmetic, extension_fields, ec_shortweierstrass], - ../../constantine/math/io/io_extfields, - ../../constantine/math/config/curves, - ../../constantine/math/pairings/pairings_bls12, + constantine/platforms/abstractions, + constantine/math/[arithmetic, extension_fields, ec_shortweierstrass], + constantine/math/io/io_extfields, + constantine/named/algebra, + constantine/math/pairings/pairings_bls12, # Test utilities - ../../helpers/prng_unsafe + helpers/prng_unsafe # Testing multipairing # ---------------------------------------------- diff --git a/tests/math_pairings/t_pairing_bls12_381_optate.nim b/tests/math_pairings/t_pairing_bls12_381_optate.nim index b51602d6..aebe5196 100644 --- a/tests/math_pairings/t_pairing_bls12_381_optate.nim +++ b/tests/math_pairings/t_pairing_bls12_381_optate.nim @@ -7,7 +7,7 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../../constantine/math/pairings/pairings_bls12, + constantine/math/pairings/pairings_bls12, # Test utilities ./t_pairing_template diff --git a/tests/math_pairings/t_pairing_bn254_nogami_gt_subgroup.nim b/tests/math_pairings/t_pairing_bn254_nogami_gt_subgroup.nim index fd1700b2..0838afd0 100644 --- a/tests/math_pairings/t_pairing_bn254_nogami_gt_subgroup.nim +++ b/tests/math_pairings/t_pairing_bn254_nogami_gt_subgroup.nim @@ -7,7 +7,7 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../../constantine/math/pairings/pairings_bn, + constantine/math/pairings/pairings_bn, # Test utilities ./t_pairing_template diff --git a/tests/math_pairings/t_pairing_bn254_nogami_multi.nim b/tests/math_pairings/t_pairing_bn254_nogami_multi.nim index b0bf59c0..1392300d 100644 --- a/tests/math_pairings/t_pairing_bn254_nogami_multi.nim +++ b/tests/math_pairings/t_pairing_bn254_nogami_multi.nim @@ -10,13 +10,13 @@ import # Standard library std/[os, times, strformat], # Internals - ../../constantine/platforms/abstractions, - ../../constantine/math/[arithmetic, extension_fields, ec_shortweierstrass], - ../../constantine/math/io/io_extfields, - ../../constantine/math/config/curves, - ../../constantine/math/pairings/pairings_bn, + constantine/platforms/abstractions, + constantine/math/[arithmetic, extension_fields, ec_shortweierstrass], + constantine/math/io/io_extfields, + constantine/named/algebra, + constantine/math/pairings/pairings_bn, # Test utilities - ../../helpers/prng_unsafe + helpers/prng_unsafe # Testing multipairing # ---------------------------------------------- diff --git a/tests/math_pairings/t_pairing_bn254_nogami_optate.nim b/tests/math_pairings/t_pairing_bn254_nogami_optate.nim index 19212ba7..f9b97375 100644 --- a/tests/math_pairings/t_pairing_bn254_nogami_optate.nim +++ b/tests/math_pairings/t_pairing_bn254_nogami_optate.nim @@ -7,7 +7,7 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../../constantine/math/pairings/pairings_bn, + constantine/math/pairings/pairings_bn, # Test utilities ./t_pairing_template diff --git a/tests/math_pairings/t_pairing_bn254_snarks_gt_subgroup.nim b/tests/math_pairings/t_pairing_bn254_snarks_gt_subgroup.nim index a058cd60..7a3002de 100644 --- a/tests/math_pairings/t_pairing_bn254_snarks_gt_subgroup.nim +++ b/tests/math_pairings/t_pairing_bn254_snarks_gt_subgroup.nim @@ -7,7 +7,7 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../../constantine/math/pairings/pairings_bn, + constantine/math/pairings/pairings_bn, # Test utilities ./t_pairing_template diff --git a/tests/math_pairings/t_pairing_bn254_snarks_multi.nim b/tests/math_pairings/t_pairing_bn254_snarks_multi.nim index dc668218..e9a963a2 100644 --- a/tests/math_pairings/t_pairing_bn254_snarks_multi.nim +++ b/tests/math_pairings/t_pairing_bn254_snarks_multi.nim @@ -10,13 +10,13 @@ import # Standard library std/[os, times, strformat], # Internals - ../../constantine/platforms/abstractions, - ../../constantine/math/[arithmetic, extension_fields, ec_shortweierstrass], - ../../constantine/math/io/io_extfields, - ../../constantine/math/config/curves, - ../../constantine/math/pairings/pairings_bn, + constantine/platforms/abstractions, + constantine/math/[arithmetic, extension_fields, ec_shortweierstrass], + constantine/math/io/io_extfields, + constantine/named/algebra, + constantine/math/pairings/pairings_bn, # Test utilities - ../../helpers/prng_unsafe + helpers/prng_unsafe # Testing multipairing # ---------------------------------------------- diff --git a/tests/math_pairings/t_pairing_bn254_snarks_optate.nim b/tests/math_pairings/t_pairing_bn254_snarks_optate.nim index b4017796..742e33bb 100644 --- a/tests/math_pairings/t_pairing_bn254_snarks_optate.nim +++ b/tests/math_pairings/t_pairing_bn254_snarks_optate.nim @@ -7,7 +7,7 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../../constantine/math/pairings/pairings_bn, + constantine/math/pairings/pairings_bn, # Test utilities ./t_pairing_template diff --git a/tests/math_pairings/t_pairing_bw6_761_gt_subgroup.nim b/tests/math_pairings/t_pairing_bw6_761_gt_subgroup.nim index 0135ee2b..7be0753b 100644 --- a/tests/math_pairings/t_pairing_bw6_761_gt_subgroup.nim +++ b/tests/math_pairings/t_pairing_bw6_761_gt_subgroup.nim @@ -7,7 +7,7 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../../constantine/math/pairings/pairings_bw6_761, + constantine/math/pairings/pairings_bw6_761, # Test utilities ./t_pairing_template diff --git a/tests/math_pairings/t_pairing_bw6_761_optate.nim b/tests/math_pairings/t_pairing_bw6_761_optate.nim index e91e8df8..b3bf3911 100644 --- a/tests/math_pairings/t_pairing_bw6_761_optate.nim +++ b/tests/math_pairings/t_pairing_bw6_761_optate.nim @@ -7,7 +7,7 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../../constantine/math/pairings/pairings_bw6_761, + constantine/math/pairings/pairings_bw6_761, # Test utilities ./t_pairing_template diff --git a/tests/math_pairings/t_pairing_cyclotomic_subgroup.nim b/tests/math_pairings/t_pairing_cyclotomic_subgroup.nim index 08f4f3b4..c4f4e2e4 100644 --- a/tests/math_pairings/t_pairing_cyclotomic_subgroup.nim +++ b/tests/math_pairings/t_pairing_cyclotomic_subgroup.nim @@ -10,15 +10,15 @@ import # Standard library std/[unittest, times], # Internals - ../../constantine/platforms/abstractions, - ../../constantine/math/arithmetic, - ../../constantine/math/extension_fields, - ../../constantine/math/config/curves, - ../../constantine/math/io/[io_bigints, io_extfields], - ../../constantine/math/pairings/cyclotomic_subgroups, - ../../constantine/math/isogenies/frobenius, + constantine/platforms/abstractions, + constantine/math/arithmetic, + constantine/math/extension_fields, + constantine/named/algebra, + constantine/math/io/[io_bigints, io_extfields], + constantine/math/pairings/cyclotomic_subgroups, + constantine/math/isogenies/frobenius, # Test utilities - ../../helpers/prng_unsafe + helpers/prng_unsafe const Iters = 4 @@ -164,4 +164,4 @@ suite "Pairing - Cyclotomic subgroup - GΦ₁₂(p) = {α ∈ Fp¹² : α^Φ₁ staticFor(curve, TestCurves): test_compressed_cycl_exp(curve, gen = Uniform) test_compressed_cycl_exp(curve, gen = HighHammingWeight) - test_compressed_cycl_exp(curve, gen = Long01Sequence) \ No newline at end of file + test_compressed_cycl_exp(curve, gen = Long01Sequence) diff --git a/tests/math_pairings/t_pairing_mul_fp12_by_lines.nim b/tests/math_pairings/t_pairing_mul_fp12_by_lines.nim index 3258359e..5ea09298 100644 --- a/tests/math_pairings/t_pairing_mul_fp12_by_lines.nim +++ b/tests/math_pairings/t_pairing_mul_fp12_by_lines.nim @@ -10,14 +10,14 @@ import # Standard library std/[tables, unittest, times], # Internals - ../../constantine/platforms/abstractions, - ../../constantine/math/arithmetic, - ../../constantine/math/extension_fields, - ../../constantine/math/config/curves, - ../../constantine/math/io/io_extfields, - ../../constantine/math/pairings/lines_eval, + constantine/platforms/abstractions, + constantine/math/arithmetic, + constantine/math/extension_fields, + constantine/named/algebra, + constantine/math/io/io_extfields, + constantine/math/pairings/lines_eval, # Test utilities - ../../helpers/prng_unsafe + helpers/prng_unsafe const Iters = 8 diff --git a/tests/math_pairings/t_pairing_template.nim b/tests/math_pairings/t_pairing_template.nim index d0c2b3af..b5eeb6c5 100644 --- a/tests/math_pairings/t_pairing_template.nim +++ b/tests/math_pairings/t_pairing_template.nim @@ -10,17 +10,17 @@ import # Standard library std/unittest, times, # Internals - ../../constantine/platforms/abstractions, - ../../constantine/math/arithmetic, - ../../constantine/math/extension_fields, - ../../constantine/math/config/curves, - ../../constantine/math/elliptic/[ec_shortweierstrass_affine, ec_shortweierstrass_projective], - ../../constantine/math/constants/[zoo_subgroups, zoo_pairings], - ../../constantine/math/pairings/cyclotomic_subgroups, - ../../constantine/math/io/io_extfields, + constantine/platforms/abstractions, + constantine/math/arithmetic, + constantine/math/extension_fields, + constantine/named/algebra, + constantine/named/zoo_subgroups, + constantine/math/elliptic/[ec_shortweierstrass_affine, ec_shortweierstrass_projective], + constantine/math/pairings/cyclotomic_subgroups, + constantine/math/io/io_extfields, # Test utilities - ../../helpers/prng_unsafe + helpers/prng_unsafe export prng_unsafe, times, unittest, @@ -28,7 +28,7 @@ export arithmetic, extension_fields, io_extfields, cyclotomic_subgroups, - abstractions, curves + abstractions, algebra type RandomGen* = enum @@ -143,4 +143,4 @@ template runGTsubgroupTests*(Iters: static int, GT: typedesc, finalExpHard_fn: u test "Final Exponentiation and GT-subgroup membership": test_gt_impl(gen = Uniform) test_gt_impl(gen = HighHammingWeight) - test_gt_impl(gen = Long01Sequence) \ No newline at end of file + test_gt_impl(gen = Long01Sequence) diff --git a/tests/math_polynomials/t_polynomials.nim b/tests/math_polynomials/t_polynomials.nim index 13c12116..12e5621b 100644 --- a/tests/math_polynomials/t_polynomials.nim +++ b/tests/math_polynomials/t_polynomials.nim @@ -10,12 +10,12 @@ import # Standard library std/[times, unittest, algorithm], # Internals - ../../constantine/math/arithmetic, - ../../constantine/math/config/curves, - ../../constantine/math/polynomials/polynomials, - ../../constantine/math/io/io_fields, + constantine/math/arithmetic, + constantine/named/algebra, + constantine/math/polynomials/polynomials, + constantine/math/io/io_fields, # Test utilities - ../../helpers/prng_unsafe + helpers/prng_unsafe const Degree = 42 const NumCoefs = Degree+1 diff --git a/tests/parallel/t_ec_shortw_jac_g1_batch_add_parallel.nim b/tests/parallel/t_ec_shortw_jac_g1_batch_add_parallel.nim index 5315bead..4119cb61 100644 --- a/tests/parallel/t_ec_shortw_jac_g1_batch_add_parallel.nim +++ b/tests/parallel/t_ec_shortw_jac_g1_batch_add_parallel.nim @@ -8,9 +8,9 @@ import # Internals - ../../constantine/math/config/curves, - ../../constantine/math/elliptic/ec_shortweierstrass_jacobian, - ../../constantine/math/arithmetic, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_jacobian, + constantine/math/arithmetic, # Test utilities ./t_ec_template_parallel diff --git a/tests/parallel/t_ec_shortw_jac_g1_msm_parallel.nim b/tests/parallel/t_ec_shortw_jac_g1_msm_parallel.nim index 89e2ab2a..1009e69e 100644 --- a/tests/parallel/t_ec_shortw_jac_g1_msm_parallel.nim +++ b/tests/parallel/t_ec_shortw_jac_g1_msm_parallel.nim @@ -8,9 +8,9 @@ import # Internals - ../../constantine/math/config/curves, - ../../constantine/math/elliptic/ec_shortweierstrass_jacobian, - ../../constantine/math/arithmetic, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_jacobian, + constantine/math/arithmetic, # Test utilities ./t_ec_template_parallel diff --git a/tests/parallel/t_ec_shortw_prj_g1_batch_add_parallel.nim b/tests/parallel/t_ec_shortw_prj_g1_batch_add_parallel.nim index 3a386b61..a56b3c35 100644 --- a/tests/parallel/t_ec_shortw_prj_g1_batch_add_parallel.nim +++ b/tests/parallel/t_ec_shortw_prj_g1_batch_add_parallel.nim @@ -8,9 +8,9 @@ import # Internals - ../../constantine/math/config/curves, - ../../constantine/math/elliptic/ec_shortweierstrass_projective, - ../../constantine/math/arithmetic, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_projective, + constantine/math/arithmetic, # Test utilities ./t_ec_template_parallel diff --git a/tests/parallel/t_ec_shortw_prj_g1_msm_parallel.nim b/tests/parallel/t_ec_shortw_prj_g1_msm_parallel.nim index 77d84db3..e655051d 100644 --- a/tests/parallel/t_ec_shortw_prj_g1_msm_parallel.nim +++ b/tests/parallel/t_ec_shortw_prj_g1_msm_parallel.nim @@ -8,9 +8,9 @@ import # Internals - ../../constantine/math/config/curves, - ../../constantine/math/elliptic/ec_shortweierstrass_projective, - ../../constantine/math/arithmetic, + constantine/named/algebra, + constantine/math/elliptic/ec_shortweierstrass_projective, + constantine/math/arithmetic, # Test utilities ./t_ec_template_parallel diff --git a/tests/parallel/t_ec_template_parallel.nim b/tests/parallel/t_ec_template_parallel.nim index d80dffa1..34e31153 100644 --- a/tests/parallel/t_ec_template_parallel.nim +++ b/tests/parallel/t_ec_template_parallel.nim @@ -16,10 +16,10 @@ import # Standard library std/[unittest, times], # Internals - ../../constantine/platforms/abstractions, - ../../constantine/math/constants/zoo_subgroups, - ../../constantine/math/[arithmetic, extension_fields], - ../../constantine/math/elliptic/[ + constantine/platforms/abstractions, + constantine/named/zoo_subgroups, + constantine/math/[arithmetic, extension_fields], + constantine/math/elliptic/[ ec_shortweierstrass_affine, ec_shortweierstrass_jacobian, ec_shortweierstrass_projective, @@ -29,9 +29,9 @@ import ec_scalar_mul, ec_multi_scalar_mul, ec_multi_scalar_mul_parallel], - ../../constantine/threadpool/threadpool, + constantine/threadpool/threadpool, # Test utilities - ../../helpers/prng_unsafe + helpers/prng_unsafe export unittest, abstractions, arithmetic # Generic sandwich diff --git a/tests/parallel/t_ec_twedwards_prj_msm_parallel.nim b/tests/parallel/t_ec_twedwards_prj_msm_parallel.nim index f6ce9251..0b8593f2 100644 --- a/tests/parallel/t_ec_twedwards_prj_msm_parallel.nim +++ b/tests/parallel/t_ec_twedwards_prj_msm_parallel.nim @@ -8,9 +8,9 @@ import # Internals - ../../constantine/math/config/curves, - ../../constantine/math/elliptic/ec_twistededwards_projective, - ../../constantine/math/arithmetic, + constantine/named/algebra, + constantine/math/elliptic/ec_twistededwards_projective, + constantine/math/arithmetic, # Test utilities ./t_ec_template_parallel diff --git a/tests/primitives/t_io_unsaturated.nim b/tests/primitives/t_io_unsaturated.nim index d405efae..4ba91bd1 100644 --- a/tests/primitives/t_io_unsaturated.nim +++ b/tests/primitives/t_io_unsaturated.nim @@ -7,12 +7,12 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import std/[unittest,times], - ../../constantine/platforms/abstractions, - ../../constantine/math/config/curves, - ../../constantine/math/arithmetic, - ../../constantine/math/arithmetic/limbs_unsaturated, - ../../constantine/math/io/io_bigints, - ../../helpers/prng_unsafe + constantine/platforms/abstractions, + constantine/named/algebra, + constantine/math/arithmetic, + constantine/math/arithmetic/limbs_unsaturated, + constantine/math/io/io_bigints, + helpers/prng_unsafe # Random seed for reproducibility var rng: RngState @@ -84,4 +84,4 @@ proc main() = for _ in 0 ..< Iters: testRoundtrip(BLS12_381, Long01Sequence) -main() \ No newline at end of file +main() diff --git a/tests/primitives/t_primitives.nim b/tests/primitives/t_primitives.nim index 41443c07..3b2f9cec 100644 --- a/tests/primitives/t_primitives.nim +++ b/tests/primitives/t_primitives.nim @@ -7,8 +7,8 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import std/[unittest, times, math], - ../../constantine/platforms/abstractions, - ../../helpers/prng_unsafe + constantine/platforms/abstractions, + helpers/prng_unsafe # Random seed for reproducibility var rng: RngState diff --git a/tests/primitives/t_primitives_extended_precision.nim b/tests/primitives/t_primitives_extended_precision.nim index 5dc5c882..ba6a600b 100644 --- a/tests/primitives/t_primitives_extended_precision.nim +++ b/tests/primitives/t_primitives_extended_precision.nim @@ -9,8 +9,8 @@ import std/[unittest, times, math], - ../../constantine/platforms/abstractions, - ../../helpers/prng_unsafe + constantine/platforms/abstractions, + helpers/prng_unsafe suite "Extended precision bugs": test $uint32 & " sanity check": diff --git a/tests/proof_systems/t_r1cs_parser.nim b/tests/proof_systems/t_r1cs_parser.nim index 499ccb9a..aa32d5c3 100644 --- a/tests/proof_systems/t_r1cs_parser.nim +++ b/tests/proof_systems/t_r1cs_parser.nim @@ -1,6 +1,6 @@ import std/[os, unittest, strutils], - ../../constantine/proof_systems/constraint_systems/r1cs_circom_parser + constantine/proof_systems/constraint_systems/r1cs_circom_parser const TestDir = currentSourcePath.rsplit(DirSep, 1)[0] diff --git a/tests/t_cipher_chacha20.nim b/tests/t_cipher_chacha20.nim index cf06588b..7403a400 100644 --- a/tests/t_cipher_chacha20.nim +++ b/tests/t_cipher_chacha20.nim @@ -8,7 +8,7 @@ import std/unittest, - ../constantine/ciphers/chacha20 + constantine/ciphers/chacha20 suite "[Cipher] Chacha20": test "Test vector 1 - RFC8439": @@ -40,4 +40,4 @@ suite "[Cipher] Chacha20": doAssert data == ciphertext discard chacha20_cipher(key, counter = 1, nonce, data) - doAssert data == cast[seq[byte]](plaintext) \ No newline at end of file + doAssert data == cast[seq[byte]](plaintext) diff --git a/tests/t_csprngs.nim b/tests/t_csprngs.nim index 8faeb1fd..33f8ee63 100644 --- a/tests/t_csprngs.nim +++ b/tests/t_csprngs.nim @@ -8,7 +8,7 @@ import std/unittest, - ../constantine/csprngs/sysrand + constantine/csprngs/sysrand suite "[CSPRNG] sysrand": test "Non-nil initialization": @@ -28,4 +28,4 @@ suite "[CSPRNG] sysrand": # TODO: # - Hamming weight average 50% - # - statistics/hypothesis tests \ No newline at end of file + # - statistics/hypothesis tests diff --git a/tests/t_ethereum_bls_signatures.nim b/tests/t_ethereum_bls_signatures.nim index 97b24ed0..9c95c906 100644 --- a/tests/t_ethereum_bls_signatures.nim +++ b/tests/t_ethereum_bls_signatures.nim @@ -9,10 +9,10 @@ import std/[os, unittest, strutils], pkg/jsony, - ../constantine/ethereum_bls_signatures_parallel, - ../constantine/serialization/codecs, - ../constantine/hashes, - ../constantine/threadpool/threadpool + constantine/ethereum_bls_signatures_parallel, + constantine/serialization/codecs, + constantine/hashes, + constantine/threadpool/threadpool type # https://github.com/ethereum/bls12-381-tests/blob/master/formats/ @@ -329,4 +329,4 @@ suite "BLS signature on BLS12381G3 - ETH 2.0 test vectors": test "aggregate_verify(seq[PublicKey], seq[message], Signature) -> bool": test_aggregate_verify() test "batch_verify(seq[PublicKey], seq[message], seq[Signature]) -> bool": - test_batch_verify() \ No newline at end of file + test_batch_verify() diff --git a/tests/t_ethereum_eip2333_bls12381_key_derivation.nim b/tests/t_ethereum_eip2333_bls12381_key_derivation.nim index 26e3b786..e6c72bfa 100644 --- a/tests/t_ethereum_eip2333_bls12381_key_derivation.nim +++ b/tests/t_ethereum_eip2333_bls12381_key_derivation.nim @@ -9,12 +9,12 @@ import std/unittest, - ../constantine/ethereum_eip2333_bls12381_key_derivation, - ../constantine/math/io/io_bigints, - ../constantine/math/config/curves, - ../constantine/math/arithmetic/bigints, - ../constantine/platforms/abstractions, - ../constantine/serialization/codecs + constantine/named/algebra, + constantine/ethereum_eip2333_bls12381_key_derivation, + constantine/math/io/io_bigints, + constantine/math/arithmetic/bigints, + constantine/platforms/abstractions, + constantine/serialization/codecs type SecretKey = matchingOrderBigInt(BLS12_381) diff --git a/tests/t_ethereum_eip4844_deneb_kzg.nim b/tests/t_ethereum_eip4844_deneb_kzg.nim index dc7cd05d..9bfe48fb 100644 --- a/tests/t_ethereum_eip4844_deneb_kzg.nim +++ b/tests/t_ethereum_eip4844_deneb_kzg.nim @@ -12,9 +12,9 @@ import # 3rd party pkg/yaml, # Internals - ../constantine/hashes, - ../constantine/serialization/codecs, - ../constantine/ethereum_eip4844_kzg + constantine/hashes, + constantine/serialization/codecs, + constantine/ethereum_eip4844_kzg # Organization # diff --git a/tests/t_ethereum_eip4844_deneb_kzg_parallel.nim b/tests/t_ethereum_eip4844_deneb_kzg_parallel.nim index 9738dd42..cc3879dc 100644 --- a/tests/t_ethereum_eip4844_deneb_kzg_parallel.nim +++ b/tests/t_ethereum_eip4844_deneb_kzg_parallel.nim @@ -12,10 +12,10 @@ import # 3rd party pkg/yaml, # Internals - ../constantine/hashes, - ../constantine/serialization/codecs, - ../constantine/ethereum_eip4844_kzg_parallel, - ../constantine/threadpool/threadpool + constantine/hashes, + constantine/serialization/codecs, + constantine/ethereum_eip4844_kzg_parallel, + constantine/threadpool/threadpool # Organization # diff --git a/tests/t_ethereum_evm_modexp.nim b/tests/t_ethereum_evm_modexp.nim index f6dfcbb6..97e93681 100644 --- a/tests/t_ethereum_evm_modexp.nim +++ b/tests/t_ethereum_evm_modexp.nim @@ -7,7 +7,7 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../constantine/ethereum_evm_precompiles, + constantine/ethereum_evm_precompiles, std/unittest suite "EVM ModExp precompile (EIP-198)": @@ -625,4 +625,4 @@ suite "EVM ModExp precompile (EIP-198)": 0xa0] var r = newSeq[byte](1) let status = r.eth_evm_modexp(input) - doAssert status == cttEVM_Success \ No newline at end of file + doAssert status == cttEVM_Success diff --git a/tests/t_ethereum_evm_precompiles.nim b/tests/t_ethereum_evm_precompiles.nim index 58399bb3..009f5e0a 100644 --- a/tests/t_ethereum_evm_precompiles.nim +++ b/tests/t_ethereum_evm_precompiles.nim @@ -12,8 +12,8 @@ import # 3rd party pkg/jsony, # Internals - ../constantine/serialization/codecs, - ../constantine/ethereum_evm_precompiles + constantine/serialization/codecs, + constantine/ethereum_evm_precompiles # Test vector source: # - https://github.com/ethereum/go-ethereum/tree/release/1.14/core/vm/testdata/precompiles diff --git a/tests/t_ethereum_verkle_ipa_primitives.nim b/tests/t_ethereum_verkle_ipa_primitives.nim index 722e3064..66664087 100644 --- a/tests/t_ethereum_verkle_ipa_primitives.nim +++ b/tests/t_ethereum_verkle_ipa_primitives.nim @@ -11,23 +11,23 @@ import ./t_ethereum_verkle_ipa_test_helper, - ../constantine/ethereum_verkle_ipa, - ../constantine/hashes, + constantine/ethereum_verkle_ipa, + constantine/hashes, std/unittest, - ../constantine/serialization/[codecs, codecs_banderwagon, codecs_status_codes], - ../constantine/math/config/[type_ff, curves], - ../constantine/math/ec_twistededwards, - ../constantine/math/io/[io_fields, io_bigints], - ../constantine/math/arithmetic, - ../constantine/math/polynomials/polynomials, - ../constantine/math/constants/zoo_generators, - ../constantine/commitments/[ + constantine/serialization/[codecs, codecs_banderwagon, codecs_status_codes], + constantine/named/algebra, + constantine/math/ec_twistededwards, + constantine/math/io/[io_fields, io_bigints], + constantine/math/arithmetic, + constantine/math/polynomials/polynomials, + constantine/named/zoo_generators, + constantine/commitments/[ pedersen_commitments, eth_verkle_ipa, eth_verkle_transcripts, protocol_quotient_check], ../tests/math_elliptic_curves/t_ec_template, - ../constantine/platforms/abstractions + constantine/platforms/abstractions # ############################################################ diff --git a/tests/t_ethereum_verkle_ipa_test_helper.nim b/tests/t_ethereum_verkle_ipa_test_helper.nim index f8190e85..b69800b4 100644 --- a/tests/t_ethereum_verkle_ipa_test_helper.nim +++ b/tests/t_ethereum_verkle_ipa_test_helper.nim @@ -14,17 +14,17 @@ # and the whole file should be deleted import - ../constantine/math/config/[type_ff, curves], - ../constantine/math/elliptic/[ + constantine/named/algebra, + constantine/math/elliptic/[ ec_twistededwards_affine, ec_twistededwards_projective ], - ../constantine/serialization/[ + constantine/serialization/[ codecs_status_codes, codecs_banderwagon, codecs ], - ../constantine/math/arithmetic + constantine/math/arithmetic # ############################################################ # diff --git a/tests/t_ethereum_verkle_primitives.nim b/tests/t_ethereum_verkle_primitives.nim index a762a68a..18bbe062 100644 --- a/tests/t_ethereum_verkle_primitives.nim +++ b/tests/t_ethereum_verkle_primitives.nim @@ -17,16 +17,16 @@ import std/[unittest, strutils], - ../constantine/math/config/[type_ff, curves], - ../constantine/math/ec_twistededwards, - ../constantine/math/io/io_fields, - ../constantine/serialization/[ + constantine/named/algebra, + constantine/math/ec_twistededwards, + constantine/math/io/io_fields, + constantine/serialization/[ codecs_status_codes, codecs_banderwagon, codecs ], - ../constantine/math/arithmetic, - ../constantine/ethereum_verkle_ipa + constantine/math/arithmetic, + constantine/ethereum_verkle_ipa # serialized points which lie on Banderwagon const expected_bit_strings: array[16, string] = [ diff --git a/tests/t_hash_sha256_vs_openssl.nim b/tests/t_hash_sha256_vs_openssl.nim index 98c1ade5..84e388e6 100644 --- a/tests/t_hash_sha256_vs_openssl.nim +++ b/tests/t_hash_sha256_vs_openssl.nim @@ -1,9 +1,9 @@ import # Internals - ../constantine/hashes, - ../constantine/serialization/codecs, + constantine/hashes, + constantine/serialization/codecs, # Helpers - ../helpers/prng_unsafe + helpers/prng_unsafe # Deal with platform mess # -------------------------------------------------------------------- diff --git a/tests/t_hash_to_curve.nim b/tests/t_hash_to_curve.nim index 83e26efb..faa5b8b7 100644 --- a/tests/t_hash_to_curve.nim +++ b/tests/t_hash_to_curve.nim @@ -12,13 +12,13 @@ import # 3rd party pkg/jsony, # Internals - ../constantine/platforms/abstractions, - ../constantine/math/config/curves, - ../constantine/math/extension_fields, - ../constantine/math/io/[io_bigints, io_ec], - ../constantine/math/ec_shortweierstrass, - ../constantine/hash_to_curve/hash_to_curve, - ../constantine/hashes + constantine/platforms/abstractions, + constantine/named/algebra, + constantine/math/extension_fields, + constantine/math/io/[io_bigints, io_ec], + constantine/math/ec_shortweierstrass, + constantine/hash_to_curve/hash_to_curve, + constantine/hashes # Serialization # -------------------------------------------------------------------------- diff --git a/tests/t_hash_to_curve_random.nim b/tests/t_hash_to_curve_random.nim index c0718e9c..8bcd7251 100644 --- a/tests/t_hash_to_curve_random.nim +++ b/tests/t_hash_to_curve_random.nim @@ -10,15 +10,15 @@ import # Standard library std/[unittest, times], # Internals - ../constantine/math/config/curves, - ../constantine/math/extension_fields, - ../constantine/math/ec_shortweierstrass, - ../constantine/hash_to_curve/hash_to_curve, - ../constantine/hashes, - ../constantine/math/constants/zoo_subgroups, - ../constantine/math/io/io_ec, + constantine/named/algebra, + constantine/named/zoo_subgroups, + constantine/math/extension_fields, + constantine/math/ec_shortweierstrass, + constantine/math/io/io_ec, + constantine/hash_to_curve/hash_to_curve, + constantine/hashes, # Test utilities - ../helpers/prng_unsafe + helpers/prng_unsafe const Iters = 6 @@ -87,4 +87,4 @@ proc testH2C_guidovranken_fuzz_failure_2() = suite "Hash-to-curve anti-regression": test "BLS12-381 G1 - Fuzzing Failure 2": - testH2C_guidovranken_fuzz_failure_2() \ No newline at end of file + testH2C_guidovranken_fuzz_failure_2() diff --git a/tests/t_hash_to_field.nim b/tests/t_hash_to_field.nim index 00a9aabc..cb3895d7 100644 --- a/tests/t_hash_to_field.nim +++ b/tests/t_hash_to_field.nim @@ -7,12 +7,12 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../constantine/hashes, - ../constantine/hash_to_curve/h2c_hash_to_field, - ../constantine/math/config/[curves_declaration, type_ff], - ../constantine/math/extension_fields/towers, - ../constantine/math/io/[io_fields, io_extfields], - ../constantine/serialization/codecs + constantine/hashes, + constantine/hash_to_curve/h2c_hash_to_field, + constantine/named/algebra, + constantine/math/extension_fields/towers, + constantine/math/io/[io_fields, io_extfields], + constantine/serialization/codecs # Test vectors for expandMessageXMD # ---------------------------------------------------------------------- diff --git a/tests/t_kdf_hkdf.nim b/tests/t_kdf_hkdf.nim index b02cdfb1..7e95bac0 100644 --- a/tests/t_kdf_hkdf.nim +++ b/tests/t_kdf_hkdf.nim @@ -7,8 +7,8 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ../constantine/serialization/codecs, - ../constantine/[hashes, mac/mac_hmac, kdf/kdf_hkdf] + constantine/serialization/codecs, + constantine/[hashes, mac/mac_hmac, kdf/kdf_hkdf] proc hexToBytes(s: string): seq[byte] = if s.len > 0: @@ -114,4 +114,4 @@ test 3: # Test with SHA-256 and zero-length salt/info "96596776afdb6377ac434c1c293ccb04" OKM = "0x8da4e775a563c18f715f802a063c5a31" & "b8a11f5c5ee1879ec3454e5f3c738d2d" & - "9d201395faa4b61a96c8" \ No newline at end of file + "9d201395faa4b61a96c8" diff --git a/tests/t_mac_hmac_sha256.nim b/tests/t_mac_hmac_sha256.nim index 8564a752..64f65db8 100644 --- a/tests/t_mac_hmac_sha256.nim +++ b/tests/t_mac_hmac_sha256.nim @@ -8,9 +8,9 @@ import std/unittest, - ../constantine/mac/mac_hmac, - ../constantine/hashes, - ../constantine/serialization/codecs + constantine/mac/mac_hmac, + constantine/hashes, + constantine/serialization/codecs type TestVector = object key: seq[byte] @@ -111,4 +111,4 @@ suite "[Message Authentication Code] HMAC-SHA256": "642062792074686520484d414320616c" & "676f726974686d2e", digest = "9b09ffa71b942fcb27635fbcd5b0e944bfdc63644f0713938a7f51535c3a35e2" - ) \ No newline at end of file + ) diff --git a/tests/t_mac_poly1305.nim b/tests/t_mac_poly1305.nim index e930b804..d423a279 100644 --- a/tests/t_mac_poly1305.nim +++ b/tests/t_mac_poly1305.nim @@ -8,7 +8,7 @@ import std/unittest, - ../constantine/mac/mac_poly1305 + constantine/mac/mac_poly1305 suite "[Message Authentication Code] Poly1305": test "Test vector 1 - RFC8439": @@ -28,4 +28,4 @@ suite "[Message Authentication Code] Poly1305": var tag: array[16, byte] poly1305.mac(tag, message, ikm) - doAssert tag == expectedTag \ No newline at end of file + doAssert tag == expectedTag