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.BigIntegerField;
|
||||||
import dk.au.pir.settings.PIRSettings;
|
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 dk.au.pir.utils.FieldElement;
|
||||||
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
public class GeneralInterPolyClient {
|
public class GeneralInterPolyClient {
|
||||||
|
@ -57,7 +56,7 @@ public class GeneralInterPolyClient {
|
||||||
for (int i = 0; i < PIRSettings.MOD_BIT_LENGTH + 1; i++) {
|
for (int i = 0; i < PIRSettings.MOD_BIT_LENGTH + 1; i++) {
|
||||||
fuckingXs[i] = BigInteger.valueOf(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.BigIntegerField;
|
||||||
import dk.au.pir.settings.PIRSettings;
|
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 dk.au.pir.utils.FieldElement;
|
||||||
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
public class InterPolyClient {
|
public class InterPolyClient {
|
||||||
|
@ -53,10 +52,10 @@ public class InterPolyClient {
|
||||||
|
|
||||||
|
|
||||||
public BigInteger receiveResults(BigInteger[] results) {
|
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++) {
|
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;
|
import java.math.BigInteger;
|
||||||
|
|
||||||
public class BigIntegerLagrangeInterpolation {
|
public class BigIntegerLagrange {
|
||||||
public static BigInteger doIt(BigInteger[] x, BigInteger[] y) {
|
public static BigInteger interpolate(BigInteger[] x, BigInteger[] y) {
|
||||||
// https://stackoverflow.com/questions/16375163/lagrange-interpolation-in-java
|
// https://stackoverflow.com/questions/16375163/lagrange-interpolation-in-java
|
||||||
BigInteger xPoint = BigInteger.ZERO; // we want to find f(0), so xpoint=0
|
BigInteger xPoint = BigInteger.ZERO; // we want to find f(0), so xpoint=0
|
||||||
BigInteger sum = BigInteger.ZERO;
|
BigInteger sum = BigInteger.ZERO;
|
Loading…
Reference in New Issue
Block a user