diff --git a/pir/src/main/java/dk/au/pir/Driver.java b/pir/src/main/java/dk/au/pir/Driver.java index 481443f..83798b5 100644 --- a/pir/src/main/java/dk/au/pir/Driver.java +++ b/pir/src/main/java/dk/au/pir/Driver.java @@ -6,7 +6,7 @@ import dk.au.pir.protocols.interpoly.InterPolyServer; import dk.au.pir.settings.PIRSettings; public class Driver { - private static int generalInterPolyTest(int ip) { + private static int generalInterPolyTest(int index) { PIRSettings settings = new PIRSettings(8, 3); int s = settings.getS(); System.out.println("s is: " + s); @@ -19,13 +19,13 @@ public class Driver { } InterPolyClient client = new InterPolyClient(settings, servers); - int res = client.receive(2); + int res = client.receive(index); System.out.println("res: " + res); return res; } public static void main(String[] args) { - generalInterPolyTest(0); + generalInterPolyTest(2); /* int sum = 0; for (int i = 0; i < 1; i++) { diff --git a/pir/src/main/java/dk/au/pir/protocols/interpoly/InterPolyDatabase.java b/pir/src/main/java/dk/au/pir/protocols/interpoly/InterPolyDatabase.java index 86ddd74..49c8478 100644 --- a/pir/src/main/java/dk/au/pir/protocols/interpoly/InterPolyDatabase.java +++ b/pir/src/main/java/dk/au/pir/protocols/interpoly/InterPolyDatabase.java @@ -2,20 +2,12 @@ package dk.au.pir.protocols.interpoly; import dk.au.pir.settings.PIRSettings; -import static dk.au.pir.utils.ProtocolUtils.printIntArrayArray; - public class InterPolyDatabase { private final int[] x; public InterPolyDatabase(PIRSettings settings) { this.x = new int[settings.getDatabaseSize()]; this.x[2] = 1; - int[][] y = new int[1][settings.getDatabaseSize()]; - y[0]= this.x; - System.out.println("This is the database"); - printIntArrayArray(y); - System.out.println(); - } public int[] getX() { diff --git a/pir/src/main/java/dk/au/pir/utils/FieldElementLagrange.java b/pir/src/main/java/dk/au/pir/utils/FieldElementLagrange.java index e06b7f4..16ee8f6 100644 --- a/pir/src/main/java/dk/au/pir/utils/FieldElementLagrange.java +++ b/pir/src/main/java/dk/au/pir/utils/FieldElementLagrange.java @@ -6,6 +6,7 @@ import java.util.Arrays; public class FieldElementLagrange { public static FieldElement interpolate(BigIntegerField field, FieldElement[] y) { + // https://stackoverflow.com/questions/16375163/lagrange-interpolation-in-java System.out.println("y: " + Arrays.deepToString(y)); FieldElement xPoint = field.valueOf(0); // we want to find f(0), so xpoint=0 FieldElement sum = field.valueOf(0);