Coverage Summary for Class: BN128Pair (co.rsk.crypto.altbn128java)

Class Class, % Method, % Line, %
BN128Pair 0% (0/1) 0% (0/5) 0% (0/9)


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  21 package co.rsk.crypto.altbn128java; 22  23 public class BN128Pair { 24  25  private BN128G1 g1; 26  private BN128G2 g2; 27  28  public static BN128Pair of(BN128G1 g1, BN128G2 g2) { 29  return new BN128Pair(g1, g2); 30  } 31  32  BN128Pair(BN128G1 g1, BN128G2 g2) { 33  this.g1 = g1; 34  this.g2 = g2; 35  } 36  37  public BN128G1 getG1() { 38  return g1; 39  } 40  41  public BN128G2 getG2() { 42  return g2; 43  } 44  45  Fp12 millerLoop() { 46  47  // miller loop result equals "1" if at least one of the points is zero 48  if (g1.isZero()) {return Fp12._1;} 49  if (g2.isZero()) {return Fp12._1;} 50  51  return PairingCheck.millerLoop(g1, g2); 52  } 53 }