diff --git a/pom.xml b/pom.xml
index b0a4d22..916c38e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -18,8 +18,8 @@
maven-compiler-plugin
3.6.0
- 1.9
- 1.9
+ 1.8
+ 1.8
diff --git a/src/main/java/edu/stanford/cs/crypto/efficientct/circuit/groups/BN128Group.java b/src/main/java/edu/stanford/cs/crypto/efficientct/circuit/groups/BN128Group.java
index 0cd0867..4accb1c 100644
--- a/src/main/java/edu/stanford/cs/crypto/efficientct/circuit/groups/BN128Group.java
+++ b/src/main/java/edu/stanford/cs/crypto/efficientct/circuit/groups/BN128Group.java
@@ -6,7 +6,7 @@
import java.math.BigInteger;
public class BN128Group extends BouncyCastleCurve {
-
+ public static final BigInteger TWO = new BigInteger("2");
public static final BigInteger P = new BigInteger("21888242871839275222246405745257275088696311157297823662689037894645226208583");
public static final BigInteger ORDER = new BigInteger("21888242871839275222246405745257275088548364400416034343698204186575808495617");
@@ -30,7 +30,7 @@ public BouncyCastleECPoint hashInto(BigInteger seed) {
seed = seed.add(BigInteger.ONE);
BigInteger ySquared = seed.pow(3).add(BigInteger.valueOf(3)).mod(P);
y = ySquared.modPow((P.add(BigInteger.ONE)).divide(BigInteger.valueOf(4)), P);
- if (y.modPow(BigInteger.TWO, P).equals(ySquared)) {
+ if (y.modPow(TWO, P).equals(ySquared)) {
break;
}
} while (true);
diff --git a/src/main/java/edu/stanford/cs/crypto/efficientct/rangeproof/SingleMultiExpRangeProofVerifier.java b/src/main/java/edu/stanford/cs/crypto/efficientct/rangeproof/SingleMultiExpRangeProofVerifier.java
index fffaace..46790fd 100644
--- a/src/main/java/edu/stanford/cs/crypto/efficientct/rangeproof/SingleMultiExpRangeProofVerifier.java
+++ b/src/main/java/edu/stanford/cs/crypto/efficientct/rangeproof/SingleMultiExpRangeProofVerifier.java
@@ -22,6 +22,7 @@
* Created by buenz on 7/1/17.
*/
public class SingleMultiExpRangeProofVerifier> implements Verifier, T, RangeProof> {
+ public static final BigInteger TWO = new BigInteger("2");
@Override
@@ -73,7 +74,7 @@ public void verify(GeneratorParams params, T input, RangeProof proof) thro
T r = rs.get(i);
BigInteger xIP = ProofUtils.computeChallenge(q, l, r);
challenges.add(xIP);
- squareChallenges.add(xIP.modPow(BigInteger.TWO,q));
+ squareChallenges.add(xIP.modPow(TWO,q));
}
diff --git a/src/test/java/edu/stanford/cs/crypto/efficientct/Playground.java b/src/test/java/edu/stanford/cs/crypto/efficientct/Playground.java
index 888ad69..83041da 100644
--- a/src/test/java/edu/stanford/cs/crypto/efficientct/Playground.java
+++ b/src/test/java/edu/stanford/cs/crypto/efficientct/Playground.java
@@ -24,6 +24,8 @@
import java.util.stream.Stream;
public class Playground {
+ public static final BigInteger TWO = new BigInteger("2");
+
@Test
public void testPlayGround() {
BigInteger q = new BigInteger("21888242871839275222246405745257275088696311157297823662689037894645226208583");
@@ -66,12 +68,12 @@ public void testSquareRoot() {
BigInteger sqrt = x.modPow((P.add(BigInteger.ONE)).divide(BigInteger.valueOf(4)), P);
System.out.println(x.modPow(P.min(BigInteger.ONE).shiftRight(1), P));
System.out.println(sqrt);
- System.out.println(sqrt.modPow(BigInteger.TWO, P));
+ System.out.println(sqrt.modPow(TWO, P));
System.out.println(x);
System.out.println("Min x");
BigInteger minX = P.min(x);
BigInteger sqrtMin = minX.modPow(P.add(BigInteger.ONE).shiftRight(2), P);
- System.out.println(sqrtMin.modPow(BigInteger.TWO, P));
+ System.out.println(sqrtMin.modPow(TWO, P));
System.out.println(minX);
}
@@ -102,7 +104,7 @@ public void testShift() {
BigInteger[] xs = new BigInteger[]{ProofUtils.hash("1"), ProofUtils.hash("2"), ProofUtils.hash("3"), ProofUtils.hash("4"), ProofUtils.hash("5")};
BigInteger P = new BigInteger("21888242871839275222246405745257275088548364400416034343698204186575808495617");
List exponents = Stream.generate(() -> BigInteger.ONE).limit(32).collect(Collectors.toList());
- String arrString= Arrays.stream(xs).map(bi->String.format("[\"0x%s\",\"0x%s\"]",bi.mod(P).toString(16),bi.modPow(BigInteger.TWO,P).toString(16))).collect(Collectors.joining(","));
+ String arrString= Arrays.stream(xs).map(bi->String.format("[\"0x%s\",\"0x%s\"]",bi.mod(P).toString(16),bi.modPow(TWO,P).toString(16))).collect(Collectors.joining(","));
System.out.println("["+arrString+"]");
int n = 32;
diff --git a/src/test/java/edu/stanford/cs/crypto/efficientct/innerproduct/BN128InnerProduct.java b/src/test/java/edu/stanford/cs/crypto/efficientct/innerproduct/BN128InnerProduct.java
index 9c16e53..ba2bf43 100644
--- a/src/test/java/edu/stanford/cs/crypto/efficientct/innerproduct/BN128InnerProduct.java
+++ b/src/test/java/edu/stanford/cs/crypto/efficientct/innerproduct/BN128InnerProduct.java
@@ -11,6 +11,8 @@
import java.util.stream.Collectors;
public class BN128InnerProduct {
+ public static final BigInteger TWO = new BigInteger("2");
+
@Test
public void createInnerProductProof() {
InnerProductProofSystem system = new InnerProductProofSystem<>();
@@ -19,7 +21,7 @@ public void createInnerProductProof() {
base.getGs().getVector().map(BouncyCastleECPoint::getPoint).map(ECPoint::normalize).map(p -> "=[0x" + p.getXCoord() + " , 0x" + p.getYCoord() + "];").zipWithIndex().map(t -> "garr[" + t.v2 + "]" + t.v1).printOut();
base.getHs().getVector().map(BouncyCastleECPoint::getPoint).map(ECPoint::normalize).map(p -> "=[0x" + p.getXCoord() + " , 0x" + p.getYCoord() + "];").zipWithIndex().map(t -> "harr[" + t.v2 + "]" + t.v1).printOut();
System.out.println(base.getH());
- FieldVector as = FieldVector.pow(BigInteger.TWO, 256, group.groupOrder());
+ FieldVector as = FieldVector.pow(TWO, 256, group.groupOrder());
// System.out.println(as);
FieldVector bs = FieldVector.pow(BigInteger.ONE, 256, group.groupOrder());
// System.out.println(bs);