-
Notifications
You must be signed in to change notification settings - Fork 11
/
EC_BN128_Modulus.hpp
40 lines (29 loc) · 1.02 KB
/
EC_BN128_Modulus.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef _SNARKLIB_EC_BN128_MODULUS_HPP_
#define _SNARKLIB_EC_BN128_MODULUS_HPP_
#include <gmp.h>
#include <snarklib/BigInt.hpp>
namespace snarklib {
////////////////////////////////////////////////////////////////////////////////
// Barreto-Naehrig (128 bits)
//
class BN128_Modulus
{
public:
// modulus R and modulus Q
static const mp_size_t r_bitcount = 254;
static const mp_size_t q_bitcount = 254;
static const mp_size_t r_limbs = (r_bitcount + GMP_NUMB_BITS - 1) / GMP_NUMB_BITS;
static const mp_size_t q_limbs = (q_bitcount + GMP_NUMB_BITS - 1) / GMP_NUMB_BITS;
static const BigInt<r_limbs>& modulus_r() {
static const BigInt<r_limbs> a(
"21888242871839275222246405745257275088548364400416034343698204186575808495617");
return a;
}
static const BigInt<q_limbs>& modulus_q() {
static const BigInt<q_limbs> a(
"21888242871839275222246405745257275088696311157297823662689037894645226208583");
return a;
}
};
} // namespace snarklib
#endif