Sober up.
This commit is contained in:
parent
1dd308df42
commit
73841f1cd1
|
@ -2,11 +2,10 @@ package dk.au.pir.protocols.general.interpoly;
|
|||
|
||||
import dk.au.pir.BigIntegerField;
|
||||
import dk.au.pir.settings.PIRSettings;
|
||||
import dk.au.pir.utils.BigIntegerLagrangeInterpolation;
|
||||
import dk.au.pir.utils.BigIntegerLagrange;
|
||||
import dk.au.pir.utils.FieldElement;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
public class GeneralInterPolyClient {
|
||||
|
@ -57,7 +56,7 @@ public class GeneralInterPolyClient {
|
|||
for (int i = 0; i < PIRSettings.MOD_BIT_LENGTH + 1; i++) {
|
||||
fuckingXs[i] = BigInteger.valueOf(i);
|
||||
}
|
||||
return BigIntegerLagrangeInterpolation.doIt(fuckingXs, results);
|
||||
return BigIntegerLagrange.interpolate(fuckingXs, results);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,11 +2,10 @@ package dk.au.pir.protocols.interpoly;
|
|||
|
||||
import dk.au.pir.BigIntegerField;
|
||||
import dk.au.pir.settings.PIRSettings;
|
||||
import dk.au.pir.utils.BigIntegerLagrangeInterpolation;
|
||||
import dk.au.pir.utils.BigIntegerLagrange;
|
||||
import dk.au.pir.utils.FieldElement;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
public class InterPolyClient {
|
||||
|
@ -53,10 +52,10 @@ public class InterPolyClient {
|
|||
|
||||
|
||||
public BigInteger receiveResults(BigInteger[] results) {
|
||||
BigInteger[] fuckingXs = new BigInteger[PIRSettings.MOD_BIT_LENGTH + 1];
|
||||
BigInteger[] xs = new BigInteger[PIRSettings.MOD_BIT_LENGTH + 1];
|
||||
for (int i = 0; i < PIRSettings.MOD_BIT_LENGTH + 1; i++) {
|
||||
fuckingXs[i] = BigInteger.valueOf(i);
|
||||
xs[i] = BigInteger.valueOf(i);
|
||||
}
|
||||
return BigIntegerLagrangeInterpolation.doIt(fuckingXs, results);
|
||||
return BigIntegerLagrange.interpolate(xs, results);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,8 +2,8 @@ package dk.au.pir.utils;
|
|||
|
||||
import java.math.BigInteger;
|
||||
|
||||
public class BigIntegerLagrangeInterpolation {
|
||||
public static BigInteger doIt(BigInteger[] x, BigInteger[] y) {
|
||||
public class BigIntegerLagrange {
|
||||
public static BigInteger interpolate(BigInteger[] x, BigInteger[] y) {
|
||||
// https://stackoverflow.com/questions/16375163/lagrange-interpolation-in-java
|
||||
BigInteger xPoint = BigInteger.ZERO; // we want to find f(0), so xpoint=0
|
||||
BigInteger sum = BigInteger.ZERO;
|
Loading…
Reference in New Issue
Block a user