1 /** @file 2 ***************************************************************************** 3 * @author This file is part of libff, developed by SCIPR Lab 4 * and contributors (see AUTHORS). 5 * @copyright MIT license (see LICENSE file) 6 *****************************************************************************/ 7 8 #ifndef ALT_BN128_INIT_HPP_ 9 #define ALT_BN128_INIT_HPP_ 10 #include <libff/algebra/curves/public_params.hpp> 11 #include <libff/algebra/fields/fp.hpp> 12 #include <libff/algebra/fields/fp12_2over3over2.hpp> 13 #include <libff/algebra/fields/fp2.hpp> 14 #include <libff/algebra/fields/fp6_3over2.hpp> 15 16 namespace libff { 17 18 const mp_size_t alt_bn128_r_bitcount = 254; 19 const mp_size_t alt_bn128_q_bitcount = 254; 20 21 const mp_size_t alt_bn128_r_limbs = (alt_bn128_r_bitcount+GMP_NUMB_BITS-1)/GMP_NUMB_BITS; 22 const mp_size_t alt_bn128_q_limbs = (alt_bn128_q_bitcount+GMP_NUMB_BITS-1)/GMP_NUMB_BITS; 23 24 extern bigint<alt_bn128_r_limbs> alt_bn128_modulus_r; 25 extern bigint<alt_bn128_q_limbs> alt_bn128_modulus_q; 26 27 typedef Fp_model<alt_bn128_r_limbs, alt_bn128_modulus_r> alt_bn128_Fr; 28 typedef Fp_model<alt_bn128_q_limbs, alt_bn128_modulus_q> alt_bn128_Fq; 29 typedef Fp2_model<alt_bn128_q_limbs, alt_bn128_modulus_q> alt_bn128_Fq2; 30 typedef Fp6_3over2_model<alt_bn128_q_limbs, alt_bn128_modulus_q> alt_bn128_Fq6; 31 typedef Fp12_2over3over2_model<alt_bn128_q_limbs, alt_bn128_modulus_q> alt_bn128_Fq12; 32 typedef alt_bn128_Fq12 alt_bn128_GT; 33 34 // parameters for Barreto--Naehrig curve E/Fq : y^2 = x^3 + b 35 extern alt_bn128_Fq alt_bn128_coeff_b; 36 // parameters for twisted Barreto--Naehrig curve E'/Fq2 : y^2 = x^3 + b/xi 37 extern alt_bn128_Fq2 alt_bn128_twist; 38 extern alt_bn128_Fq2 alt_bn128_twist_coeff_b; 39 extern alt_bn128_Fq alt_bn128_twist_mul_by_b_c0; 40 extern alt_bn128_Fq alt_bn128_twist_mul_by_b_c1; 41 extern alt_bn128_Fq2 alt_bn128_twist_mul_by_q_X; 42 extern alt_bn128_Fq2 alt_bn128_twist_mul_by_q_Y; 43 44 // parameters for pairing 45 extern bigint<alt_bn128_q_limbs> alt_bn128_ate_loop_count; 46 extern bool alt_bn128_ate_is_loop_count_neg; 47 extern bigint<12*alt_bn128_q_limbs> alt_bn128_final_exponent; 48 extern bigint<alt_bn128_q_limbs> alt_bn128_final_exponent_z; 49 extern bool alt_bn128_final_exponent_is_z_neg; 50 51 void init_alt_bn128_params(); 52 53 class alt_bn128_G1; 54 class alt_bn128_G2; 55 56 } // libff 57 #endif // ALT_BN128_INIT_HPP_ 58