Coverage Summary for Class: Params (co.rsk.crypto.altbn128java)
Class |
Class, %
|
Method, %
|
Line, %
|
Params |
0%
(0/1)
|
0%
(0/2)
|
0%
(0/10)
|
1 /*
2 * This file is part of RskJ
3 * Copyright (C) 2019 RSK Labs Ltd.
4 * (derived from ethereumJ library, Copyright (c) 2016 <ether.camp>)
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 package co.rsk.crypto.altbn128java;
21
22 import java.math.BigInteger;
23
24 /**
25 * Common params for BN curves, its derivatives and pairing
26 *
27 * @author Mikhail Kalinin
28 * @since 31.08.2017
29 */
30 class Params {
31
32 private Params() {
33 throw new IllegalStateException("Utility class");
34 }
35
36 /**
37 * "p" field parameter of F_p, F_p2, F_p6 and F_p12
38 */
39 public static final BigInteger P = new BigInteger("21888242871839275222246405745257275088696311157297823662689037894645226208583");
40
41 /**
42 * "r" order of {@link BN128G2} cyclic subgroup
43 */
44 public static final BigInteger R = new BigInteger("21888242871839275222246405745257275088548364400416034343698204186575808495617");
45
46 /**
47 * "b" curve parameter for {@link BN128Fp}
48 */
49 public static final Fp B_Fp = Fp.create(BigInteger.valueOf(3));
50
51 /**
52 * Twist parameter for the curves
53 */
54 public static final Fp2 TWIST = Fp2.create(BigInteger.valueOf(9), BigInteger.valueOf(1));
55
56 /**
57 * "b" curve parameter for {@link BN128Fp2}
58 */
59 public static final Fp2 B_Fp2 = B_Fp.mul(TWIST.inverse());
60
61 public static final Fp2 TWIST_MUL_BY_P_X = Fp2.create(
62 new BigInteger("21575463638280843010398324269430826099269044274347216827212613867836435027261"),
63 new BigInteger("10307601595873709700152284273816112264069230130616436755625194854815875713954")
64 );
65
66 public static final Fp2 TWIST_MUL_BY_P_Y = Fp2.create(
67 new BigInteger("2821565182194536844548159561693502659359617185244120367078079554186484126554"),
68 new BigInteger("3505843767911556378687030309984248845540243509899259641013678093033130930403")
69 );
70
71 public static final BigInteger PAIRING_FINAL_EXPONENT_Z = new BigInteger("4965661367192848881");
72 }